"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/states/esxi.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

esxi.py  (salt-2019.2.0):esxi.py  (salt-2019.2.1)
skipping to change at line 1062 skipping to change at line 1062
erase_disks erase_disks
Specifies whether to erase all partitions on all disks member of the Specifies whether to erase all partitions on all disks member of the
disk group before the disk group is created. Default value is False. disk group before the disk group is created. Default value is False.
''' '''
proxy_details = __salt__['esxi.get_details']() proxy_details = __salt__['esxi.get_details']()
hostname = proxy_details['host'] if not proxy_details.get('vcenter') \ hostname = proxy_details['host'] if not proxy_details.get('vcenter') \
else proxy_details['esxi_host'] else proxy_details['esxi_host']
log.info('Running state {0} for host \'{1}\''.format(name, hostname)) log.info('Running state {0} for host \'{1}\''.format(name, hostname))
# Variable used to return the result of the invocation # Variable used to return the result of the invocation
ret = {'name': name, 'result': None, 'changes': {}, ret = {'name': name,
'pchanges': {}, 'comments': None} 'result': None,
'changes': {},
'comments': None}
# Signals if errors have been encountered # Signals if errors have been encountered
errors = False errors = False
# Signals if changes are required # Signals if changes are required
changes = False changes = False
comments = [] comments = []
diskgroup_changes = {} diskgroup_changes = {}
si = None si = None
try: try:
log.trace('Validating diskgroups_configured input') log.trace('Validating diskgroups_configured input')
schema = DiskGroupsDiskScsiAddressSchema.serialize() schema = DiskGroupsDiskScsiAddressSchema.serialize()
skipping to change at line 1286 skipping to change at line 1288
''.format(idx)) ''.format(idx))
log.info(s) log.info(s)
comments.append(s) comments.append(s)
__salt__['vsphere.disconnect'](si) __salt__['vsphere.disconnect'](si)
#Build the final return message #Build the final return message
result = (True if not (changes or errors) else # no changes/errors result = (True if not (changes or errors) else # no changes/errors
None if __opts__['test'] else # running in test mode None if __opts__['test'] else # running in test mode
False if errors else True) # found errors; defaults to True False if errors else True) # found errors; defaults to True
ret.update({'result': result, ret.update({'result': result,
'comment': '\n'.join(comments)}) 'comment': '\n'.join(comments),
if changes: 'changes': diskgroup_changes})
if __opts__['test']:
ret['pchanges'] = diskgroup_changes
elif changes:
ret['changes'] = diskgroup_changes
return ret return ret
@depends(HAS_PYVMOMI) @depends(HAS_PYVMOMI)
@depends(HAS_JSONSCHEMA) @depends(HAS_JSONSCHEMA)
def host_cache_configured(name, enabled, datastore, swap_size='100%', def host_cache_configured(name, enabled, datastore, swap_size='100%',
dedicated_backing_disk=False, dedicated_backing_disk=False,
erase_backing_disk=False): erase_backing_disk=False):
''' '''
Configures the host cache used for swapping. Configures the host cache used for swapping.
skipping to change at line 1378 skipping to change at line 1376
log.trace('enabled = %s', enabled) log.trace('enabled = %s', enabled)
log.trace('datastore = %s', datastore) log.trace('datastore = %s', datastore)
log.trace('swap_size = %s', swap_size) log.trace('swap_size = %s', swap_size)
log.trace('erase_backing_disk = %s', erase_backing_disk) log.trace('erase_backing_disk = %s', erase_backing_disk)
# Variable used to return the result of the invocation # Variable used to return the result of the invocation
proxy_details = __salt__['esxi.get_details']() proxy_details = __salt__['esxi.get_details']()
hostname = proxy_details['host'] if not proxy_details.get('vcenter') \ hostname = proxy_details['host'] if not proxy_details.get('vcenter') \
else proxy_details['esxi_host'] else proxy_details['esxi_host']
log.trace('hostname = %s', hostname) log.trace('hostname = %s', hostname)
log.info('Running host_cache_swap_configured for host \'%s\'', hostname) log.info('Running host_cache_swap_configured for host \'%s\'', hostname)
ret = {'name': hostname, 'comment': 'Default comments', ret = {'name': hostname,
'result': None, 'changes': {}, 'pchanges': {}} 'comment': 'Default comments',
'result': None,
'changes': {}}
result = None if __opts__['test'] else True # We assume success result = None if __opts__['test'] else True # We assume success
needs_setting = False needs_setting = False
comments = [] comments = []
changes = {} changes = {}
si = None si = None
try: try:
log.debug('Validating host_cache_configured input') log.debug('Validating host_cache_configured input')
schema = HostCacheSchema.serialize() schema = HostCacheSchema.serialize()
try: try:
jsonschema.validate({'enabled': enabled, jsonschema.validate({'enabled': enabled,
skipping to change at line 1573 skipping to change at line 1573
service_instance=si) service_instance=si)
comments.append('Host cache configured on host ' comments.append('Host cache configured on host '
'\'{0}\'.'.format(hostname)) '\'{0}\'.'.format(hostname))
else: else:
comments.append('Host cache on host \'{0}\' is already correctly ' comments.append('Host cache on host \'{0}\' is already correctly '
'configured. Nothing to be done.'.format(hostname)) 'configured. Nothing to be done.'.format(hostname))
result = True result = True
__salt__['vsphere.disconnect'](si) __salt__['vsphere.disconnect'](si)
log.info(comments[-1]) log.info(comments[-1])
ret.update({'comment': '\n'.join(comments), ret.update({'comment': '\n'.join(comments),
'result': result}) 'result': result,
if __opts__['test']: 'changes': changes})
ret['pchanges'] = changes
else:
ret['changes'] = changes
return ret return ret
except CommandExecutionError as err: except CommandExecutionError as err:
log.error('Error: %s.', err) log.error('Error: %s.', err)
if si: if si:
__salt__['vsphere.disconnect'](si) __salt__['vsphere.disconnect'](si)
ret.update({ ret.update({
'result': False if not __opts__['test'] else None, 'result': False if not __opts__['test'] else None,
'comment': '{}.'.format(err)}) 'comment': '{}.'.format(err)})
return ret return ret
 End of changes. 4 change blocks. 
15 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)