mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
lxc: Repair merge
Conflicts: salt/runners/lxc.py
This commit is contained in:
parent
117ecb1fe0
commit
725b0462ca
1 changed files with 14 additions and 2 deletions
|
@ -208,6 +208,19 @@ def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
|
|||
ret['comment'] = 'Container names are not formed as a list'
|
||||
ret['result'] = False
|
||||
return ret
|
||||
# check that the host is alive
|
||||
client = salt.client.get_local_client(__opts__['conf_file'])
|
||||
alive = False
|
||||
try:
|
||||
if client.cmd(host, 'test.ping', timeout=20).get(host, None):
|
||||
alive = True
|
||||
except (TypeError, KeyError):
|
||||
pass
|
||||
if not alive:
|
||||
ret['comment'] = 'Host {0} is not reachable'.format(host)
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
log.info('Searching for LXC Hosts')
|
||||
data = __salt__['lxc.list'](host, quiet=True)
|
||||
for host, containers in data.items():
|
||||
|
@ -222,7 +235,6 @@ def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
|
|||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
client = salt.client.get_local_client(__opts__['conf_file'])
|
||||
|
||||
kw = dict((k, v) for k, v in kwargs.items() if not k.startswith('__'))
|
||||
pub_key = kw.get('pub_key', None)
|
||||
|
@ -257,7 +269,7 @@ def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
|
|||
cmds = []
|
||||
for name in names:
|
||||
args = [name]
|
||||
kw = kwargs
|
||||
kw = salt.utils.clean_kwargs(kwargs)
|
||||
if saltcloud_mode:
|
||||
kw = copy.deepcopy(kw)
|
||||
kw['name'] = name
|
||||
|
|
Loading…
Add table
Reference in a new issue