Merge branch 'develop' into add-vault-approle

This commit is contained in:
slaws 2017-11-28 20:41:40 +01:00 committed by GitHub
commit 8d7704dca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 21 deletions

View File

@ -560,9 +560,10 @@ def get_configured_provider(vm_=None):
# in all cases, verify that the linked saltmaster is alive. # in all cases, verify that the linked saltmaster is alive.
if data: if data:
ret = _salt('test.ping', salt_target=data['target']) ret = _salt('test.ping', salt_target=data['target'])
if not ret: if ret:
raise SaltCloudSystemExit( return data
else:
log.error(
'Configured provider {0} minion: {1} is unreachable'.format( 'Configured provider {0} minion: {1} is unreachable'.format(
__active_provider_name__, data['target'])) __active_provider_name__, data['target']))
return data
return False return False

View File

@ -2475,10 +2475,9 @@ def _linux_iqn():
if os.path.isfile(initiator): if os.path.isfile(initiator):
with salt.utils.files.fopen(initiator, 'r') as _iscsi: with salt.utils.files.fopen(initiator, 'r') as _iscsi:
for line in _iscsi: for line in _iscsi:
if line.find('InitiatorName') != -1: line = line.strip()
iqn = line.split('=') if line.startswith('InitiatorName='):
final_iqn = iqn[1].rstrip() ret.append(line.split('=', 1)[1])
ret.extend([final_iqn])
return ret return ret
@ -2492,9 +2491,10 @@ def _aix_iqn():
aixret = __salt__['cmd.run'](aixcmd) aixret = __salt__['cmd.run'](aixcmd)
if aixret[0].isalpha(): if aixret[0].isalpha():
iqn = aixret.split() try:
final_iqn = iqn[1].rstrip() ret.append(aixret.split()[1].rstrip())
ret.extend([final_iqn]) except IndexError:
pass
return ret return ret
@ -2507,8 +2507,7 @@ def _linux_wwns():
for fcfile in glob.glob('/sys/class/fc_host/*/port_name'): for fcfile in glob.glob('/sys/class/fc_host/*/port_name'):
with salt.utils.files.fopen(fcfile, 'r') as _wwn: with salt.utils.files.fopen(fcfile, 'r') as _wwn:
for line in _wwn: for line in _wwn:
line = line.rstrip() ret.append(line.rstrip()[2:])
ret.extend([line[2:]])
return ret return ret
@ -2534,8 +2533,7 @@ def _windows_iqn():
for line in cmdret['stdout'].splitlines(): for line in cmdret['stdout'].splitlines():
if line[0].isalpha(): if line[0].isalpha():
continue continue
line = line.rstrip() ret.append(line.rstrip())
ret.extend([line])
return ret return ret
@ -2551,7 +2549,6 @@ def _windows_wwns():
cmdret = __salt__['cmd.run_ps'](ps_cmd) cmdret = __salt__['cmd.run_ps'](ps_cmd)
for line in cmdret: for line in cmdret:
line = line.rstrip() ret.append(line.rstrip())
ret.append(line)
return ret return ret

View File

@ -392,9 +392,9 @@ def absent(name,
The special keyword used in the job (eg. @reboot, @hourly...). The special keyword used in the job (eg. @reboot, @hourly...).
Quotes must be used, otherwise PyYAML will strip the '@' sign. Quotes must be used, otherwise PyYAML will strip the '@' sign.
''' '''
### NOTE: The keyword arguments in **kwargs are ignored in this state, but # NOTE: The keyword arguments in **kwargs are ignored in this state, but
### cannot be removed from the function definition, otherwise the use # cannot be removed from the function definition, otherwise the use
### of unsupported arguments will result in a traceback. # of unsupported arguments will result in a traceback.
name = name.strip() name = name.strip()
if identifier is False: if identifier is False:
@ -566,6 +566,7 @@ def file(name,
user, user,
group, group,
mode, mode,
[], # no special attrs for cron
template, template,
context, context,
defaults, defaults,

View File

@ -57,7 +57,7 @@ class SSHStateTest(SSHCase):
test state.show_top with salt-ssh test state.show_top with salt-ssh
''' '''
ret = self.run_function('state.show_top') ret = self.run_function('state.show_top')
self.assertEqual(ret, {u'base': [u'master_tops_test', u'core']}) self.assertEqual(ret, {u'base': [u'core', u'master_tops_test']})
def test_state_single(self): def test_state_single(self):
''' '''

View File

@ -477,7 +477,8 @@ PATCHLEVEL = 3
'/proc/meminfo': True '/proc/meminfo': True
} }
_cmd_run_map = { _cmd_run_map = {
'dpkg --print-architecture': 'amd64' 'dpkg --print-architecture': 'amd64',
'rpm --eval %{_host_cpu}': 'x86_64'
} }
path_exists_mock = MagicMock(side_effect=lambda x: _path_exists_map[x]) path_exists_mock = MagicMock(side_effect=lambda x: _path_exists_map[x])