- vim = {}
- if newname: vim['name'] = newname
- if user: vim['vim_user'] = user
- if password: vim['vim_password'] = password
- if auth_url: vim['vim_url'] = auth_url
- if tenant: vim['vim-tenant-name'] = tenant
- if account_type: vim['vim_type'] = account_type
- if description: vim['description'] = description
- config_dict = {}
- if config is not None:
- if config=="" and (sdncontroller or sdn_port_mapping):
- raise ClientException("clearing config is incompatible with updating SDN info")
- if config=="":
- vim['config'] = None
- else:
- config_dict = yaml.safe_load(config)
- if sdn_controller: config_dict['sdn_controller'] = sdn_controller
- if sdn_port_mapping:
- with open(sdn_port_mapping, 'r') as f:
- config_dict['sdn_port_mapping'] = yaml.safe_load(f.read())
- if 'config' not in vim and config_dict:
- vim['config'] = yaml.safe_dump(config_dict)