mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Step 2: Some "stuff" happens (adding logs adjacent to prints)
This commit is contained in:
parent
46f1974809
commit
46e30a3a3b
@ -12,7 +12,6 @@ Primary interfaces for the salt-cloud system
|
||||
# Import python libs
|
||||
import optparse
|
||||
import os
|
||||
import pprint
|
||||
|
||||
# Import salt libs
|
||||
import saltcloud.config
|
||||
|
@ -58,9 +58,11 @@ class Cloud(object):
|
||||
for prov in provs:
|
||||
fun = '{0}.{1}'.format(prov, query)
|
||||
if not fun in self.clouds:
|
||||
print('Public cloud provider {0} is not available'.format(
|
||||
msg = ('Public cloud provider {0} is not available'.format(
|
||||
self.provider(vm_))
|
||||
)
|
||||
print(msg)
|
||||
log.error(msg)
|
||||
continue
|
||||
try:
|
||||
pmap[prov] = self.clouds[fun]()
|
||||
@ -157,9 +159,11 @@ class Cloud(object):
|
||||
'''
|
||||
fun = '{0}.create'.format(self.provider(vm_))
|
||||
if not fun in self.clouds:
|
||||
print('Public cloud provider {0} is not available'.format(
|
||||
msg = ('Public cloud provider {0} is not available'.format(
|
||||
self.provider(vm_))
|
||||
)
|
||||
print(msg)
|
||||
log.error(msg)
|
||||
return
|
||||
priv, pub = saltcloud.utils.gen_keys(
|
||||
saltcloud.utils.get_option('keysize', self.opts, vm_)
|
||||
@ -175,8 +179,10 @@ class Cloud(object):
|
||||
try:
|
||||
ok = self.clouds['{0}.create'.format(self.provider(vm_))](vm_)
|
||||
except KeyError as exc:
|
||||
print('Failed to create vm {0}. Configuration value {1} needs '
|
||||
msg = ('Failed to create vm {0}. Configuration value {1} needs '
|
||||
'to be set'.format(vm_['name'], exc))
|
||||
print(msg)
|
||||
log.error(msg)
|
||||
|
||||
def profile_provider(self, profile=None):
|
||||
for definition in self.opts['vm']:
|
||||
@ -204,6 +210,7 @@ class Cloud(object):
|
||||
if name in current_boxen:
|
||||
# The specified vm already exists, don't make it anew
|
||||
print("{0} already exists on {1}".format(name, current_boxen[name]))
|
||||
log.warn("{0} already exists on {1}".format(name, current_boxen[name]))
|
||||
continue
|
||||
vm_['name'] = name
|
||||
if self.opts['parallel']:
|
||||
@ -214,6 +221,7 @@ class Cloud(object):
|
||||
self.create(vm_)
|
||||
if not found:
|
||||
print('Profile {0} is not defined'.format(self.opts['profile']))
|
||||
log.error('Profile {0} is not defined'.format(self.opts['profile']))
|
||||
|
||||
|
||||
class Map(Cloud):
|
||||
@ -249,6 +257,7 @@ class Map(Cloud):
|
||||
for vm in query_map[profile]:
|
||||
names.append(vm)
|
||||
print("VMs to delete: {0}\n".format(names))
|
||||
log.warn("VMs to delete: {0}\n".format(names))
|
||||
return names
|
||||
|
||||
def read(self):
|
||||
@ -316,9 +325,11 @@ class Map(Cloud):
|
||||
for name in dmap['destroy']:
|
||||
msg += ' {0}\n'.format(name)
|
||||
print(msg)
|
||||
log.warn(msg)
|
||||
res = raw_input('Proceed? [N/y]')
|
||||
if not res.lower().startswith('y'):
|
||||
return
|
||||
log.warn('...proceeding')
|
||||
# We are good to go, execute!
|
||||
# Generate the fingerprint of the master pubkey in
|
||||
# order to mitigate man-in-the-middle attacks
|
||||
|
@ -68,6 +68,7 @@ def __virtual__():
|
||||
for conf in confs:
|
||||
if conf not in __opts__:
|
||||
return False
|
||||
log.debug('Loading AWS cloud module')
|
||||
return 'aws'
|
||||
|
||||
|
||||
@ -176,6 +177,7 @@ def create(vm_):
|
||||
'''
|
||||
location = get_location(vm_)
|
||||
print('Creating Cloud VM {0} in {1}'.format(vm_['name'], location))
|
||||
log.warn('Creating Cloud VM {0} in {1}'.format(vm_['name'], location))
|
||||
conn = get_conn(location=location)
|
||||
usernames = ssh_username(vm_)
|
||||
kwargs = {'ssh_key': __opts__['AWS.private_key']}
|
||||
@ -199,8 +201,10 @@ def create(vm_):
|
||||
vm_['name'], exc
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
print('Created node {0}'.format(vm_['name']))
|
||||
log.warn('Created node {0}'.format(vm_['name']))
|
||||
while not data.public_ips:
|
||||
time.sleep(0.5)
|
||||
data = get_node(conn, vm_['name'])
|
||||
@ -231,17 +235,20 @@ def create(vm_):
|
||||
sock_dir=__opts__['sock_dir'])
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
volumes = vm_.get('map_volumes')
|
||||
if volumes:
|
||||
print ('Create and attach volumes to node {0}'.format(data.name))
|
||||
print('Create and attach volumes to node {0}'.format(data.name))
|
||||
log.warn('Create and attach volumes to node {0}'.format(data.name))
|
||||
create_attach_volumes(volumes,location, data)
|
||||
|
||||
|
||||
@ -259,4 +266,5 @@ def create_attach_volumes(volumes, location, data):
|
||||
created_volume = conn.create_volume(volume['size'], volume_name, avz)
|
||||
attach = conn.attach_volume(data, created_volume, volume['device'])
|
||||
if attach:
|
||||
print ('{0} attached to {1} (aka {2}) as device {3}'.format(created_volume.id, data.id, data.name, volume['device']))
|
||||
print('{0} attached to {1} (aka {2}) as device {3}'.format(created_volume.id, data.id, data.name, volume['device']))
|
||||
log.warn('{0} attached to {1} (aka {2}) as device {3}'.format(created_volume.id, data.id, data.name, volume['device']))
|
||||
|
@ -56,6 +56,7 @@ def __virtual__():
|
||||
Set up the libcloud funcstions and check for RACKSPACE configs
|
||||
'''
|
||||
if 'GOGRID.apikey' in __opts__ and 'GOGRID.sharedsecret' in __opts__:
|
||||
log.debug('Loading GoGrid cloud module')
|
||||
return 'gogrid'
|
||||
return False
|
||||
|
||||
@ -76,6 +77,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -92,6 +94,7 @@ def create(vm_):
|
||||
vm_['name'], message
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
deployed = saltcloud.utils.deploy_script(
|
||||
host=data.public_ips[0],
|
||||
@ -102,11 +105,15 @@ def create(vm_):
|
||||
sock_dir=__opts__['sock_dir'])
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -62,6 +62,7 @@ def __virtual__():
|
||||
Set up the libcloud funcstions and check for RACKSPACE configs
|
||||
'''
|
||||
if 'IBMSCE.user' in __opts__ and 'IBMSCE.password' in __opts__:
|
||||
log.debug('Loading IBM SCE cloud module')
|
||||
return 'ibmsce'
|
||||
return False
|
||||
|
||||
@ -82,6 +83,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -93,6 +95,7 @@ def create(vm_):
|
||||
kwargs['auth'] = NodeAuthSSHKey(__opts__['IBMSCE.ssh_key_name'])
|
||||
|
||||
print('Creating instance on {0} at {1}'.format(time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S')))
|
||||
log.warn('Creating instance on {0} at {1}'.format(time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S')))
|
||||
try:
|
||||
data = conn.create_node(**kwargs)
|
||||
except Exception as exc:
|
||||
@ -103,17 +106,20 @@ def create(vm_):
|
||||
vm_['name'], message
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
print()
|
||||
return False
|
||||
|
||||
not_ready = True
|
||||
nr_count = 0
|
||||
while not_ready:
|
||||
print('Looking for IP addresses for IBM SCE host {0} ({1} {2})'.format(
|
||||
msg=('Looking for IP addresses for IBM SCE host {0} ({1} {2})'.format(
|
||||
vm_['name'],
|
||||
time.strftime('%Y-%m-%d'),
|
||||
time.strftime('%H:%M:%S'),
|
||||
))
|
||||
print(msg)
|
||||
log.warn(msg)
|
||||
nodelist = list_nodes()
|
||||
private = nodelist[vm_['name']]['private_ips']
|
||||
if private:
|
||||
@ -128,6 +134,7 @@ def create(vm_):
|
||||
time.sleep(15)
|
||||
|
||||
print('Deploying {0} using IP address {1}'.format(vm_['name'], data.public_ips[0]))
|
||||
log.warn('Deploying {0} using IP address {1}'.format(vm_['name'], data.public_ips[0]))
|
||||
|
||||
deployed = saltcloud.utils.deploy_script(
|
||||
host=data.public_ips[0],
|
||||
@ -140,11 +147,13 @@ def create(vm_):
|
||||
sock_dir=__opts__['sock_dir'])
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -56,6 +56,7 @@ def __virtual__():
|
||||
Set up the libcloud functions and check for JOYENT configs
|
||||
'''
|
||||
if 'JOYENT.user' in __opts__ and 'JOYENT.password' in __opts__:
|
||||
log.debug('Loading Joyent cloud module')
|
||||
return 'joyent'
|
||||
return False
|
||||
|
||||
@ -76,6 +77,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -91,6 +93,7 @@ def create(vm_):
|
||||
vm_['name'], exc.message
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
if saltcloud.utils.wait_for_ssh(data.public_ips[0]):
|
||||
cmd = ('ssh -oStrictHostKeyChecking=no -t -i {0} {1}@{2} '
|
||||
@ -103,9 +106,10 @@ def create(vm_):
|
||||
subprocess.call(cmd, shell=True)
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -48,6 +48,7 @@ def __virtual__():
|
||||
Set up the libcloud funcstions and check for RACKSPACE configs
|
||||
'''
|
||||
if 'LINODE.apikey' in __opts__:
|
||||
log.debug('Loading Linode cloud module')
|
||||
return 'linode'
|
||||
return False
|
||||
|
||||
@ -97,6 +98,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -114,6 +116,7 @@ def create(vm_):
|
||||
vm_['name'], exc.message
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
deployed = saltcloud.utils.deploy_script(
|
||||
host=data.public_ips[0],
|
||||
@ -124,11 +127,13 @@ def create(vm_):
|
||||
sock_dir=__opts__['sock_dir'])
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -70,6 +70,7 @@ def __virtual__():
|
||||
Set up the libcloud functions and check for OPENSTACK configs
|
||||
'''
|
||||
if 'OPENSTACK.user' in __opts__ and 'OPENSTACK.password' in __opts__:
|
||||
log.debug('Loading Openstack cloud module')
|
||||
return 'openstack'
|
||||
return False
|
||||
|
||||
@ -103,6 +104,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -116,6 +118,7 @@ def create(vm_):
|
||||
vm_['name'], vm_['image']
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
|
||||
try:
|
||||
@ -145,18 +148,22 @@ def create(vm_):
|
||||
nr_count = 0
|
||||
while not_ready:
|
||||
print('Looking for IP addresses')
|
||||
log.warn('Looking for IP addresses')
|
||||
nodelist = list_nodes()
|
||||
private = nodelist[vm_['name']]['private_ips']
|
||||
public = nodelist[vm_['name']]['public_ips']
|
||||
if private and not public:
|
||||
print('Private IPs returned, but not public... checking for misidentified IPs')
|
||||
log.warn('Private IPs returned, but not public... checking for misidentified IPs')
|
||||
for private_ip in private:
|
||||
if saltcloud.utils.is_public_ip(private_ip):
|
||||
print('{0} is a public ip'.format(private_ip))
|
||||
log.warn('{0} is a public ip'.format(private_ip))
|
||||
data.public_ips.append(private_ip)
|
||||
not_ready = False
|
||||
else:
|
||||
print('{0} is a private ip'.format(private_ip))
|
||||
log.warn('{0} is a private ip'.format(private_ip))
|
||||
if private_ip not in data.private_ips:
|
||||
data.private_ips.append(private_ip)
|
||||
nr_count += 1
|
||||
@ -184,15 +191,16 @@ def create(vm_):
|
||||
if 'sudo' in vm_:
|
||||
deployargs['sudo'] = vm_['sudo']
|
||||
|
||||
print('Running deploy script')
|
||||
deployed = saltcloud.utils.deploy_script(**deployargs)
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -55,6 +55,7 @@ def __virtual__():
|
||||
Set up the libcloud funcstions and check for RACKSPACE configs
|
||||
'''
|
||||
if 'RACKSPACE.user' in __opts__ and 'RACKSPACE.apikey' in __opts__:
|
||||
log.debug('Loading Rackspace cloud module')
|
||||
return 'rackspace'
|
||||
return False
|
||||
|
||||
@ -75,6 +76,7 @@ def create(vm_):
|
||||
Create a single vm from a data dict
|
||||
'''
|
||||
print('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
conn = get_conn()
|
||||
deploy_script = script(vm_)
|
||||
kwargs = {}
|
||||
@ -90,6 +92,7 @@ def create(vm_):
|
||||
vm_['name'], exc
|
||||
)
|
||||
sys.stderr.write(err)
|
||||
log.error(err)
|
||||
return False
|
||||
deployed = saltcloud.utils.deploy_script(
|
||||
host=data.public_ips[0],
|
||||
@ -100,11 +103,13 @@ def create(vm_):
|
||||
sock_dir=__opts__['sock_dir'])
|
||||
if deployed:
|
||||
print('Salt installed on {0}'.format(vm_['name']))
|
||||
log.warn('Salt installed on {0}'.format(vm_['name']))
|
||||
else:
|
||||
print('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
log.warn('Failed to start Salt on Cloud VM {0}'.format(vm_['name']))
|
||||
|
||||
print('Created Cloud VM {0} with the following values:'.format(
|
||||
vm_['name']
|
||||
))
|
||||
print('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
log.warn('Created Cloud VM {0} with the following values:'.format(vm_['name']))
|
||||
for key, val in data.__dict__.items():
|
||||
print(' {0}: {1}'.format(key, val))
|
||||
log.warn(' {0}: {1}'.format(key, val))
|
||||
|
@ -164,13 +164,17 @@ def destroy(name):
|
||||
node = get_node(conn, name)
|
||||
if node is None:
|
||||
print('Unable to find the VM {0}'.format(name))
|
||||
log.warn('Unable to find the VM {0}'.format(name))
|
||||
print('Destroying VM: {0}'.format(name))
|
||||
log.warn('Destroying VM: {0}'.format(name))
|
||||
ret = conn.destroy_node(node)
|
||||
if ret:
|
||||
print('Destroyed VM: {0}'.format(name))
|
||||
log.warn('Destroyed VM: {0}'.format(name))
|
||||
return True
|
||||
else:
|
||||
print('Failed to Destroy VM: {0}'.format(name))
|
||||
log.error('Failed to Destroy VM: {0}'.format(name))
|
||||
return False
|
||||
|
||||
|
||||
@ -214,8 +218,6 @@ def list_nodes_select():
|
||||
conn = get_conn()
|
||||
nodes = conn.list_nodes()
|
||||
ret = {}
|
||||
import sys
|
||||
from pprint import pprint
|
||||
for node in nodes:
|
||||
pairs = {}
|
||||
data = node.__dict__
|
||||
|
@ -18,6 +18,7 @@ try:
|
||||
import paramiko
|
||||
except:
|
||||
print('Cannot import paramiko. Please make sure it is correctly installed.')
|
||||
log.error('Cannot import paramiko. Please make sure it is correctly installed.')
|
||||
sys.exit(1)
|
||||
|
||||
# Import salt libs
|
||||
@ -193,14 +194,17 @@ def wait_for_passwd(host, port=22, timeout=900, username='root',
|
||||
ssh.close()
|
||||
trycount += 1
|
||||
print('Attempting to authenticate (try {0} of {1}): {2}'.format(trycount, maxtries, authexc))
|
||||
log.warn('Attempting to authenticate (try {0} of {1}): {2}'.format(trycount, maxtries, authexc))
|
||||
if trycount < maxtries:
|
||||
sleep(trysleep)
|
||||
continue
|
||||
else:
|
||||
print('Authencication failed: {0}'.format(authexec))
|
||||
log.warn('Authencication failed: {0}'.format(authexec))
|
||||
return False
|
||||
except Exception as exc:
|
||||
print('There was an error in wait_for_passwd: {0}'.format(exc))
|
||||
log.error('There was an error in wait_for_passwd: {0}'.format(exc))
|
||||
if tryconnect:
|
||||
return True
|
||||
return False
|
||||
@ -237,6 +241,7 @@ def deploy_script(host, port=22, timeout=900, username='root',
|
||||
ssh.connect(**kwargs)
|
||||
except Exception as exc:
|
||||
print('There was an error in deploy_script: {0}'.format(exc))
|
||||
log.error('There was an error in deploy_script: {0}'.format(exc))
|
||||
if provider == 'ibmsce':
|
||||
ssh.exec_command('sudo sed -i "s/#Subsystem/Subsystem/" /etc/ssh/sshd_config')
|
||||
stdin, stdout, stderr = ssh.exec_command('sudo service sshd restart')
|
||||
@ -268,6 +273,7 @@ def deploy_script(host, port=22, timeout=900, username='root',
|
||||
process.join()
|
||||
if queuereturn:
|
||||
print('Running state.highstate on minion')
|
||||
log.warn('Running state.highstate on minion')
|
||||
#client = salt.client.LocalClient(conf_file)
|
||||
#output = client.cmd_iter(host, 'state.highstate', timeout=timeout)
|
||||
#for line in output:
|
||||
@ -320,6 +326,7 @@ def check_auth(name, pub_key=None, sock_dir=None, queue=None, timeout=300):
|
||||
queue.put(name)
|
||||
newtimeout = 0
|
||||
print('Minion {0} is ready to receive commands'.format(name))
|
||||
log.warn('Minion {0} is ready to receive commands'.format(name))
|
||||
|
||||
|
||||
def ip_to_int(ip):
|
||||
|
Loading…
Reference in New Issue
Block a user