mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge salt.cloud.utils
into salt.utils
.
Fixed `salt.cloud.utils` references into `salt.utils.cloud`.
This commit is contained in:
parent
9767d83e67
commit
9223cea0db
@ -15,7 +15,6 @@ import multiprocessing
|
||||
from itertools import groupby
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.event
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudNotFound,
|
||||
@ -29,6 +28,7 @@ import salt.config
|
||||
import salt.client
|
||||
import salt.loader
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
from salt.utils import context
|
||||
|
||||
# Import third party libs
|
||||
@ -89,7 +89,7 @@ class CloudClient(object):
|
||||
List all available sizes in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.size_list(provider))
|
||||
|
||||
def list_images(self, provider=None):
|
||||
@ -97,7 +97,7 @@ class CloudClient(object):
|
||||
List all available images in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.image_list(provider))
|
||||
|
||||
def list_locations(self, provider=None):
|
||||
@ -105,7 +105,7 @@ class CloudClient(object):
|
||||
List all available locations in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.location_list(provider))
|
||||
|
||||
def query(self, query_type='list_nodes'):
|
||||
@ -136,7 +136,7 @@ class CloudClient(object):
|
||||
mapper = salt.cloud.Map(self._opts_defaults(**kwargs))
|
||||
if isinstance(names, str):
|
||||
names = names.split(',')
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.run_profile(profile, names))
|
||||
|
||||
def destroy(self, names):
|
||||
@ -146,7 +146,7 @@ class CloudClient(object):
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
if isinstance(names, str):
|
||||
names = names.split(',')
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.destroy(names))
|
||||
|
||||
def action(self, fun=None, cloudmap=None, names=None, provider=None,
|
||||
@ -172,7 +172,7 @@ class CloudClient(object):
|
||||
'Either an instance or a provider must be specified.'
|
||||
)
|
||||
|
||||
return salt.cloud.utils.simple_types_filter(
|
||||
return salt.utils.cloud.simple_types_filter(
|
||||
mapper.run_profile(fun, names))
|
||||
|
||||
# map
|
||||
@ -585,14 +585,14 @@ class Cloud(object):
|
||||
if not os.path.isfile(key_file) and not globbed_key_file:
|
||||
# There's no such key file!? It might have been renamed
|
||||
if isinstance(ret, dict) and 'newname' in ret:
|
||||
salt.cloud.utils.remove_key(
|
||||
salt.utils.cloud.remove_key(
|
||||
self.opts['pki_dir'], ret['newname']
|
||||
)
|
||||
continue
|
||||
|
||||
if os.path.isfile(key_file) and not globbed_key_file:
|
||||
# Single key entry. Remove it!
|
||||
salt.cloud.utils.remove_key(self.opts['pki_dir'], name)
|
||||
salt.utils.cloud.remove_key(self.opts['pki_dir'], name)
|
||||
continue
|
||||
|
||||
if not os.path.isfile(key_file) and globbed_key_file:
|
||||
@ -601,7 +601,7 @@ class Cloud(object):
|
||||
# append_domain set.
|
||||
if len(globbed_key_file) == 1:
|
||||
# Single entry, let's remove it!
|
||||
salt.cloud.utils.remove_key(
|
||||
salt.utils.cloud.remove_key(
|
||||
self.opts['pki_dir'],
|
||||
os.path.basename(globbed_key_file[0])
|
||||
)
|
||||
@ -645,7 +645,7 @@ class Cloud(object):
|
||||
'Delete {0!r}? [Y/n]? '.format(filename)
|
||||
)
|
||||
if delete == '' or delete.lower().startswith('y'):
|
||||
salt.cloud.utils.remove_key(
|
||||
salt.utils.cloud.remove_key(
|
||||
self.opts['pki_dir'], filename
|
||||
)
|
||||
print('Deleted {0!r}'.format(filename))
|
||||
@ -726,7 +726,7 @@ class Cloud(object):
|
||||
|
||||
if 'pub_key' not in vm_ and 'priv_key' not in vm_:
|
||||
log.debug('Generating minion keys for {0[name]!r}'.format(vm_))
|
||||
priv, pub = salt.cloud.utils.gen_keys(
|
||||
priv, pub = salt.utils.cloud.gen_keys(
|
||||
salt.config.get_config_value('keysize', vm_, self.opts)
|
||||
)
|
||||
vm_['pub_key'] = pub
|
||||
@ -749,7 +749,7 @@ class Cloud(object):
|
||||
vm_
|
||||
)
|
||||
)
|
||||
master_priv, master_pub = salt.cloud.utils.gen_keys(
|
||||
master_priv, master_pub = salt.utils.cloud.gen_keys(
|
||||
salt.config.get_config_value('keysize', vm_, self.opts)
|
||||
)
|
||||
vm_['master_pub'] = master_pub
|
||||
@ -757,7 +757,7 @@ class Cloud(object):
|
||||
elif local_master is True and deploy is True:
|
||||
# Since we're not creating a master, and we're deploying, accept
|
||||
# the key on the local master
|
||||
salt.cloud.utils.accept_key(
|
||||
salt.utils.cloud.accept_key(
|
||||
self.opts['pki_dir'], vm_['pub_key'], key_id
|
||||
)
|
||||
|
||||
@ -1419,7 +1419,7 @@ class Map(Cloud):
|
||||
log.debug(
|
||||
'Generating master keys for {0[name]!r}'.format(master_profile)
|
||||
)
|
||||
priv, pub = salt.cloud.utils.gen_keys(
|
||||
priv, pub = salt.utils.cloud.gen_keys(
|
||||
salt.config.get_config_value('keysize', master_profile, self.opts)
|
||||
)
|
||||
master_profile['master_pub'] = pub
|
||||
@ -1451,7 +1451,7 @@ class Map(Cloud):
|
||||
log.debug(
|
||||
'Generating minion keys for {0[name]!r}'.format(profile)
|
||||
)
|
||||
priv, pub = salt.cloud.utils.gen_keys(
|
||||
priv, pub = salt.utils.cloud.gen_keys(
|
||||
salt.config.get_config_value('keysize', profile, self.opts)
|
||||
)
|
||||
profile['pub_key'] = pub
|
||||
@ -1626,7 +1626,7 @@ def create_multiprocessing(parallel_data):
|
||||
output.pop('deploy_kwargs', None)
|
||||
|
||||
return {
|
||||
parallel_data['name']: salt.cloud.utils.simple_types_filter(output)
|
||||
parallel_data['name']: salt.utils.cloud.simple_types_filter(output)
|
||||
}
|
||||
|
||||
|
||||
@ -1644,7 +1644,7 @@ def run_parallel_map_providers_query(data):
|
||||
return (
|
||||
data['alias'],
|
||||
data['driver'],
|
||||
salt.cloud.utils.simple_types_filter(
|
||||
salt.utils.cloud.simple_types_filter(
|
||||
cloud.clouds[data['fun']]()
|
||||
)
|
||||
)
|
||||
|
@ -51,7 +51,7 @@ import logging
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.exceptions import SaltCloudException, SaltCloudSystemExit
|
||||
|
||||
|
@ -29,7 +29,7 @@ import logging
|
||||
# Import salt cloud libs
|
||||
import salt.config as config
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import SaltCloudSystemExit
|
||||
|
||||
# CloudStackNetwork will be needed during creation of a new node
|
||||
@ -203,7 +203,7 @@ def create(vm_):
|
||||
'''
|
||||
Create a single VM from a data dict
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -229,7 +229,7 @@ def create(vm_):
|
||||
if get_networkid(vm_) is not False:
|
||||
kwargs['networkids'] = get_networkid(vm_)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -297,7 +297,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -305,7 +305,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -319,7 +319,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -337,7 +337,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -346,9 +346,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -368,7 +368,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -42,7 +42,7 @@ import urllib2
|
||||
import logging
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
@ -240,7 +240,7 @@ def create(vm_):
|
||||
'''
|
||||
Create a single VM from a data dict
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -279,7 +279,7 @@ def create(vm_):
|
||||
)
|
||||
kwargs['private_networking'] = 'true' if private_networking else 'false'
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -310,7 +310,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_['name'],),
|
||||
timeout=config.get_config_value(
|
||||
@ -370,7 +370,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -378,7 +378,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -392,7 +392,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -410,7 +410,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -419,9 +419,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -440,7 +440,7 @@ def create(vm_):
|
||||
)
|
||||
ret.update(data)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -509,12 +509,12 @@ def script(vm_):
|
||||
'''
|
||||
Return the script deployment object
|
||||
'''
|
||||
script = salt.cloud.utils.os_script(
|
||||
script = salt.utils.cloud.os_script(
|
||||
config.get_config_value('script', vm_, __opts__),
|
||||
vm_,
|
||||
__opts__,
|
||||
salt.cloud.utils.salt_config_to_yaml(
|
||||
salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
salt.utils.cloud.salt_config_to_yaml(
|
||||
salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
)
|
||||
)
|
||||
return script
|
||||
@ -618,7 +618,7 @@ def destroy(name, call=None):
|
||||
|
||||
salt-cloud --destroy mymachine
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -628,7 +628,7 @@ def destroy(name, call=None):
|
||||
data = show_instance(name, call='action')
|
||||
node = query(method='droplets', command='{0}/destroy'.format(data['id']))
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -86,7 +86,7 @@ import urllib2
|
||||
from salt._compat import ElementTree as ET
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.exceptions import (
|
||||
@ -546,12 +546,12 @@ def script(vm_):
|
||||
'''
|
||||
Return the script deployment object
|
||||
'''
|
||||
return salt.cloud.utils.os_script(
|
||||
return salt.utils.cloud.os_script(
|
||||
config.get_config_value('script', vm_, __opts__),
|
||||
vm_,
|
||||
__opts__,
|
||||
salt.cloud.utils.salt_config_to_yaml(
|
||||
salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
salt.utils.cloud.salt_config_to_yaml(
|
||||
salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
)
|
||||
)
|
||||
|
||||
@ -825,7 +825,7 @@ def create(vm_=None, call=None):
|
||||
'You cannot create an instance with -a or -f.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -1034,7 +1034,7 @@ def create(vm_=None, call=None):
|
||||
|
||||
tags['Name'] = vm_['name']
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -1100,7 +1100,7 @@ def create(vm_=None, call=None):
|
||||
'Nothing else we can do here.')
|
||||
return False
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'waiting for spot instance',
|
||||
'salt/cloud/{0}/waiting_for_spot'.format(vm_['name']),
|
||||
@ -1134,7 +1134,7 @@ def create(vm_=None, call=None):
|
||||
# Pull the instance ID, valid for both spot and normal instances
|
||||
instance_id = data[0]['instanceId']
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'querying instance',
|
||||
'salt/cloud/{0}/querying'.format(vm_['name']),
|
||||
@ -1200,7 +1200,7 @@ def create(vm_=None, call=None):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_ip_address,
|
||||
update_args=(params, requesturl),
|
||||
timeout=config.get_config_value(
|
||||
@ -1217,7 +1217,7 @@ def create(vm_=None, call=None):
|
||||
finally:
|
||||
raise SaltCloudSystemExit(exc.message)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'setting tags',
|
||||
'salt/cloud/{0}/tagging'.format(vm_['name']),
|
||||
@ -1241,7 +1241,7 @@ def create(vm_=None, call=None):
|
||||
'display_ssh_output', vm_, __opts__, default=True
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'waiting for ssh',
|
||||
'salt/cloud/{0}/waiting_for_ssh'.format(vm_['name']),
|
||||
@ -1252,9 +1252,9 @@ def create(vm_=None, call=None):
|
||||
'ssh_connect_timeout', vm_, __opts__, 900 # 15 minutes
|
||||
)
|
||||
|
||||
if salt.cloud.utils.wait_for_port(ip_address, timeout=ssh_connect_timeout):
|
||||
if salt.utils.cloud.wait_for_port(ip_address, timeout=ssh_connect_timeout):
|
||||
for user in usernames:
|
||||
if salt.cloud.utils.wait_for_passwd(
|
||||
if salt.utils.cloud.wait_for_passwd(
|
||||
host=ip_address,
|
||||
username=user,
|
||||
ssh_timeout=config.get_config_value(
|
||||
@ -1307,7 +1307,7 @@ def create(vm_=None, call=None):
|
||||
'keep_tmp': __opts__['keep_tmp'],
|
||||
'preseed_minion_keys': vm_.get('preseed_minion_keys', None),
|
||||
'display_ssh_output': display_ssh_output,
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_),
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_),
|
||||
'script_args': config.get_config_value(
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
@ -1321,7 +1321,7 @@ def create(vm_=None, call=None):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -1335,7 +1335,7 @@ def create(vm_=None, call=None):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -1353,7 +1353,7 @@ def create(vm_=None, call=None):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -1362,9 +1362,9 @@ def create(vm_=None, call=None):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {name}'.format(**vm_))
|
||||
@ -1388,7 +1388,7 @@ def create(vm_=None, call=None):
|
||||
'volumes', vm_, __opts__, search_global=True
|
||||
)
|
||||
if volumes:
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'attaching volumes',
|
||||
'salt/cloud/{0}/attaching_volumes'.format(vm_['name']),
|
||||
@ -1408,7 +1408,7 @@ def create(vm_=None, call=None):
|
||||
)
|
||||
ret['Attached Volumes'] = created
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -1667,7 +1667,7 @@ def rename(name, kwargs, call=None):
|
||||
|
||||
set_tags(name, {'Name': kwargs['newname']}, call='action')
|
||||
|
||||
salt.cloud.utils.rename_key(
|
||||
salt.utils.cloud.rename_key(
|
||||
__opts__['pki_dir'], name, kwargs['newname']
|
||||
)
|
||||
|
||||
@ -1690,7 +1690,7 @@ def destroy(name, call=None):
|
||||
quiet=True
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -1735,7 +1735,7 @@ def destroy(name, call=None):
|
||||
result = query(params)
|
||||
ret['spotInstance'] = result[0]
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -47,7 +47,7 @@ from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import SaltCloudSystemExit
|
||||
|
||||
# Get logging started
|
||||
@ -122,7 +122,7 @@ def create(vm_):
|
||||
'present on the system.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -141,7 +141,7 @@ def create(vm_):
|
||||
'size': get_size(conn, vm_)
|
||||
}
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -208,7 +208,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -216,7 +216,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -230,7 +230,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -248,7 +248,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -257,9 +257,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -278,7 +278,7 @@ def create(vm_):
|
||||
)
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -58,7 +58,7 @@ from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
SaltCloudSystemExit,
|
||||
@ -159,7 +159,7 @@ def create(vm_):
|
||||
'system for the password.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -191,7 +191,7 @@ def create(vm_):
|
||||
)
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -232,7 +232,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_['name'], data),
|
||||
timeout=config.get_config_value(
|
||||
@ -282,7 +282,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -290,7 +290,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -304,7 +304,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -321,7 +321,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -330,9 +330,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -349,7 +349,7 @@ def create(vm_):
|
||||
)
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -64,9 +64,9 @@ import yaml
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function, is_public_ip
|
||||
from salt.utils.cloud import namespaced_function, is_public_ip
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudSystemExit,
|
||||
SaltCloudExecutionFailure,
|
||||
@ -189,7 +189,7 @@ def create(vm_):
|
||||
'system for the password.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -208,7 +208,7 @@ def create(vm_):
|
||||
)
|
||||
|
||||
## added . for fqdn hostnames
|
||||
salt.cloud.utils.check_name(vm_['name'], 'a-zA-Z0-9-.')
|
||||
salt.utils.cloud.check_name(vm_['name'], 'a-zA-Z0-9-.')
|
||||
kwargs = {
|
||||
'name': vm_['name'],
|
||||
'image': get_image(vm_),
|
||||
@ -217,7 +217,7 @@ def create(vm_):
|
||||
|
||||
}
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -264,7 +264,7 @@ def create(vm_):
|
||||
'\n\t\t-- please wait for IP addresses to be assigned...'
|
||||
)
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(
|
||||
data['id'],
|
||||
@ -333,7 +333,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -341,7 +341,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -355,7 +355,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -373,7 +373,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -382,9 +382,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -404,7 +404,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -462,7 +462,7 @@ def destroy(name, call=None):
|
||||
salt-cloud -d vm_name
|
||||
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -473,7 +473,7 @@ def destroy(name, call=None):
|
||||
ret = query2(command='my/machines/{0}'.format(node['id']),
|
||||
location=node['location'], method='DELETE')
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -53,9 +53,9 @@ import pprint
|
||||
import logging
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.libcloudfuncs import destroy as libcloudfuncs_destroy
|
||||
from salt.cloud.exceptions import (
|
||||
@ -401,7 +401,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__get_node_data,
|
||||
update_args=(conn, vm_['name']),
|
||||
timeout=config.get_config_value(
|
||||
@ -432,9 +432,9 @@ def create(vm_):
|
||||
ssh_connect_timeout = config.get_config_value(
|
||||
'ssh_connect_timeout', vm_, __opts__, 900 # 15 minutes
|
||||
)
|
||||
if salt.cloud.utils.wait_for_port(ip_address, timeout=ssh_connect_timeout):
|
||||
if salt.utils.cloud.wait_for_port(ip_address, timeout=ssh_connect_timeout):
|
||||
for user in usernames:
|
||||
if salt.cloud.utils.wait_for_passwd(
|
||||
if salt.utils.cloud.wait_for_passwd(
|
||||
host=ip_address,
|
||||
username=user,
|
||||
ssh_timeout=config.get_config_value(
|
||||
@ -488,7 +488,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -496,7 +496,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -510,7 +510,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -524,9 +524,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {name}'.format(**vm_))
|
||||
@ -733,7 +733,7 @@ def rename(name, kwargs, call=None):
|
||||
try:
|
||||
log.info('Renaming {0} to {1}'.format(name, kwargs['newname']))
|
||||
conn.ex_create_tags(resource=node, tags=tags)
|
||||
salt.cloud.utils.rename_key(
|
||||
salt.utils.cloud.rename_key(
|
||||
__opts__['pki_dir'], name, kwargs['newname']
|
||||
)
|
||||
except Exception as exc:
|
||||
|
@ -39,7 +39,7 @@ from libcloud.compute.base import NodeAuthPassword
|
||||
# Import salt cloud libs
|
||||
import salt.config as config
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
|
||||
|
||||
# Get logging started
|
||||
@ -126,7 +126,7 @@ def create(vm_):
|
||||
'''
|
||||
Create a single VM from a data dict
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -147,7 +147,7 @@ def create(vm_):
|
||||
'auth': NodeAuthPassword(get_password(vm_))
|
||||
}
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -215,7 +215,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -223,7 +223,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -237,7 +237,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -255,7 +255,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -264,9 +264,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -286,7 +286,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -109,9 +109,9 @@ except ImportError:
|
||||
from salt.utils import memoize
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
SaltCloudNotFound,
|
||||
@ -288,7 +288,7 @@ def create(vm_):
|
||||
'system for the password.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -300,7 +300,7 @@ def create(vm_):
|
||||
)
|
||||
|
||||
log.info('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
salt.cloud.utils.check_name(vm_['name'], 'a-zA-Z0-9._-')
|
||||
salt.utils.cloud.check_name(vm_['name'], 'a-zA-Z0-9._-')
|
||||
conn = get_conn()
|
||||
kwargs = {
|
||||
'name': vm_['name']
|
||||
@ -394,7 +394,7 @@ def create(vm_):
|
||||
with salt.utils.fopen(userdata_file, 'r') as fp:
|
||||
kwargs['ex_userdata'] = fp.read()
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -487,7 +487,7 @@ def create(vm_):
|
||||
)
|
||||
for private_ip in private:
|
||||
private_ip = preferred_ip(vm_, [private_ip])
|
||||
if salt.cloud.utils.is_public_ip(private_ip):
|
||||
if salt.utils.cloud.is_public_ip(private_ip):
|
||||
log.warn('{0} is a public IP'.format(private_ip))
|
||||
data.public_ips.append(private_ip)
|
||||
log.warn(
|
||||
@ -517,7 +517,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_, data, floating),
|
||||
timeout=config.get_config_value(
|
||||
@ -584,7 +584,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
if ssh_username != 'root':
|
||||
@ -612,7 +612,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -626,7 +626,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -644,7 +644,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -653,9 +653,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -675,7 +675,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -146,9 +146,9 @@ from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
import salt.utils
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
SaltCloudNotFound,
|
||||
@ -364,7 +364,7 @@ def create(vm_):
|
||||
'system for the password.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -376,7 +376,7 @@ def create(vm_):
|
||||
)
|
||||
|
||||
log.info('Creating Cloud VM {0}'.format(vm_['name']))
|
||||
salt.cloud.utils.check_name(vm_['name'], 'a-zA-Z0-9._-')
|
||||
salt.utils.cloud.check_name(vm_['name'], 'a-zA-Z0-9._-')
|
||||
conn = get_conn()
|
||||
kwargs = {
|
||||
'name': vm_['name']
|
||||
@ -479,7 +479,7 @@ def create(vm_):
|
||||
with salt.utils.fopen(userdata_file, 'r') as fp:
|
||||
kwargs['ex_userdata'] = fp.read()
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -580,7 +580,7 @@ def create(vm_):
|
||||
)
|
||||
for private_ip in private:
|
||||
private_ip = preferred_ip(vm_, [private_ip])
|
||||
if salt.cloud.utils.is_public_ip(private_ip):
|
||||
if salt.utils.cloud.is_public_ip(private_ip):
|
||||
log.warn('{0} is a public IP'.format(private_ip))
|
||||
data.public_ips.append(private_ip)
|
||||
log.warn(
|
||||
@ -610,7 +610,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_, data, floating),
|
||||
timeout=config.get_config_value(
|
||||
@ -673,7 +673,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
if ssh_username != 'root':
|
||||
@ -708,7 +708,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -722,7 +722,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -740,7 +740,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -749,9 +749,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -771,7 +771,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -46,7 +46,7 @@ import salt.utils
|
||||
from salt._compat import ElementTree as ET
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudNotFound,
|
||||
@ -254,7 +254,7 @@ def create_node(vm_):
|
||||
|
||||
data = ET.tostring(content, encoding='UTF-8')
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -276,7 +276,7 @@ def create(vm_):
|
||||
'present on the system.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -319,7 +319,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_['name'],),
|
||||
timeout=config.get_config_value(
|
||||
@ -384,7 +384,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -392,7 +392,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -406,7 +406,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -423,7 +423,7 @@ def create(vm_):
|
||||
if 'password' in event_kwargs:
|
||||
del(event_kwargs['password'])
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -432,9 +432,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -452,7 +452,7 @@ def create(vm_):
|
||||
)
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -547,12 +547,12 @@ def script(vm_):
|
||||
'''
|
||||
Return the script deployment object
|
||||
'''
|
||||
return salt.cloud.utils.os_script(
|
||||
return salt.utils.cloud.os_script(
|
||||
config.get_config_value('script', vm_, __opts__),
|
||||
vm_,
|
||||
__opts__,
|
||||
salt.cloud.utils.salt_config_to_yaml(
|
||||
salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
salt.utils.cloud.salt_config_to_yaml(
|
||||
salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
)
|
||||
)
|
||||
|
||||
@ -619,7 +619,7 @@ def destroy(name, call=None):
|
||||
|
||||
salt-cloud --destroy mymachine
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -641,7 +641,7 @@ def destroy(name, call=None):
|
||||
if 'error' in data:
|
||||
return data['error']
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -55,9 +55,9 @@ from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
import salt.utils
|
||||
|
||||
# Import salt.cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
from salt.cloud.exceptions import (
|
||||
SaltCloudSystemExit,
|
||||
SaltCloudExecutionFailure,
|
||||
@ -205,7 +205,7 @@ def create(vm_):
|
||||
'present on the system.'
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -224,7 +224,7 @@ def create(vm_):
|
||||
'size': get_size(conn, vm_)
|
||||
}
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -286,7 +286,7 @@ def create(vm_):
|
||||
)
|
||||
for private_ip in private:
|
||||
private_ip = preferred_ip(vm_, [private_ip])
|
||||
if salt.cloud.utils.is_public_ip(private_ip):
|
||||
if salt.utils.cloud.is_public_ip(private_ip):
|
||||
log.warn('{0} is a public IP'.format(private_ip))
|
||||
data.public_ips.append(private_ip)
|
||||
else:
|
||||
@ -308,7 +308,7 @@ def create(vm_):
|
||||
return data
|
||||
|
||||
try:
|
||||
data = salt.cloud.utils.wait_for_ip(
|
||||
data = salt.utils.cloud.wait_for_ip(
|
||||
__query_node_data,
|
||||
update_args=(vm_, data),
|
||||
timeout=config.get_config_value(
|
||||
@ -381,7 +381,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -389,7 +389,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -403,7 +403,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -421,7 +421,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -430,9 +430,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -452,7 +452,7 @@ def create(vm_):
|
||||
|
||||
ret.update(data.__dict__)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
|
@ -20,7 +20,7 @@ import logging
|
||||
import salt.utils
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import SaltCloudConfigError, SaltCloudSystemExit
|
||||
|
||||
@ -126,7 +126,7 @@ def create(vm_):
|
||||
'key_filename': key_filename,
|
||||
'script_args': config.get_config_value('script_args', vm_, __opts__),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_),
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_),
|
||||
'preseed_minion_keys': vm_.get('preseed_minion_keys', None),
|
||||
'display_ssh_output': config.get_config_value(
|
||||
'display_ssh_output', vm_, __opts__, default=True
|
||||
@ -138,7 +138,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -151,7 +151,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -169,7 +169,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -178,9 +178,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
ret['deployed'] = deployed
|
||||
@ -201,12 +201,12 @@ def script(vm_):
|
||||
'''
|
||||
Return the script deployment object
|
||||
'''
|
||||
return salt.cloud.utils.os_script(
|
||||
return salt.utils.cloud.os_script(
|
||||
config.get_config_value('script', vm_, __opts__),
|
||||
vm_,
|
||||
__opts__,
|
||||
salt.cloud.utils.salt_config_to_yaml(
|
||||
salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
salt.utils.cloud.salt_config_to_yaml(
|
||||
salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -32,7 +32,7 @@ import time
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import SaltCloudSystemExit
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
|
||||
# Attempt to import softlayer lib
|
||||
try:
|
||||
@ -380,7 +380,7 @@ def create(vm_):
|
||||
'''
|
||||
Create a single VM from a data dict
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -459,7 +459,7 @@ def create(vm_):
|
||||
if location:
|
||||
kwargs['location'] = location
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -492,7 +492,7 @@ def create(vm_):
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
ip_address = salt.cloud.utils.wait_for_fun(
|
||||
ip_address = salt.utils.cloud.wait_for_fun(
|
||||
wait_for_ip,
|
||||
timeout=config.get_config_value(
|
||||
'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
|
||||
@ -501,7 +501,7 @@ def create(vm_):
|
||||
ssh_connect_timeout = config.get_config_value(
|
||||
'ssh_connect_timeout', vm_, __opts__, 900 # 15 minutes
|
||||
)
|
||||
if not salt.cloud.utils.wait_for_port(ip_address,
|
||||
if not salt.utils.cloud.wait_for_port(ip_address,
|
||||
timeout=ssh_connect_timeout):
|
||||
raise SaltCloudSystemExit(
|
||||
'Failed to authenticate against remote ssh'
|
||||
@ -529,7 +529,7 @@ def create(vm_):
|
||||
time.sleep(5)
|
||||
return False
|
||||
|
||||
passwd = salt.cloud.utils.wait_for_fun(
|
||||
passwd = salt.utils.cloud.wait_for_fun(
|
||||
get_passwd,
|
||||
timeout=config.get_config_value(
|
||||
'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
|
||||
@ -581,7 +581,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -589,7 +589,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -603,7 +603,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -621,7 +621,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -630,9 +630,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -652,7 +652,7 @@ def create(vm_):
|
||||
|
||||
ret.update(response)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -752,7 +752,7 @@ def destroy(name, call=None):
|
||||
|
||||
salt-cloud --destroy mymachine
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -771,7 +771,7 @@ def destroy(name, call=None):
|
||||
}
|
||||
)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -32,7 +32,7 @@ import time
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import SaltCloudSystemExit
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
from salt.cloud.utils import namespaced_function
|
||||
from salt.utils.cloud import namespaced_function
|
||||
|
||||
# Attempt to import softlayer lib
|
||||
try:
|
||||
@ -212,7 +212,7 @@ def create(vm_):
|
||||
'''
|
||||
Create a single VM from a data dict
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'starting create',
|
||||
'salt/cloud/{0}/creating'.format(vm_['name']),
|
||||
@ -283,7 +283,7 @@ def create(vm_):
|
||||
'maxSpeed': int(max_net_speed)
|
||||
}]
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'requesting instance',
|
||||
'salt/cloud/{0}/requesting'.format(vm_['name']),
|
||||
@ -321,7 +321,7 @@ def create(vm_):
|
||||
time.sleep(1)
|
||||
return False
|
||||
|
||||
ip_address = salt.cloud.utils.wait_for_fun(
|
||||
ip_address = salt.utils.cloud.wait_for_fun(
|
||||
wait_for_ip,
|
||||
timeout=config.get_config_value(
|
||||
'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
|
||||
@ -332,7 +332,7 @@ def create(vm_):
|
||||
ssh_connect_timeout = config.get_config_value(
|
||||
'ssh_connect_timeout', vm_, __opts__, 900 # 15 minutes
|
||||
)
|
||||
if not salt.cloud.utils.wait_for_port(ip_address,
|
||||
if not salt.utils.cloud.wait_for_port(ip_address,
|
||||
timeout=ssh_connect_timeout):
|
||||
raise SaltCloudSystemExit(
|
||||
'Failed to authenticate against remote ssh'
|
||||
@ -360,7 +360,7 @@ def create(vm_):
|
||||
time.sleep(5)
|
||||
return False
|
||||
|
||||
passwd = salt.cloud.utils.wait_for_fun(
|
||||
passwd = salt.utils.cloud.wait_for_fun(
|
||||
get_passwd,
|
||||
timeout=config.get_config_value(
|
||||
'wait_for_fun_timeout', vm_, __opts__, default=15 * 60),
|
||||
@ -412,7 +412,7 @@ def create(vm_):
|
||||
'script_args', vm_, __opts__
|
||||
),
|
||||
'script_env': config.get_config_value('script_env', vm_, __opts__),
|
||||
'minion_conf': salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
'minion_conf': salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
}
|
||||
|
||||
# Deploy salt-master files, if necessary
|
||||
@ -420,7 +420,7 @@ def create(vm_):
|
||||
deploy_kwargs['make_master'] = True
|
||||
deploy_kwargs['master_pub'] = vm_['master_pub']
|
||||
deploy_kwargs['master_pem'] = vm_['master_pem']
|
||||
master_conf = salt.cloud.utils.master_config(__opts__, vm_)
|
||||
master_conf = salt.utils.cloud.master_config(__opts__, vm_)
|
||||
deploy_kwargs['master_conf'] = master_conf
|
||||
|
||||
if master_conf.get('syndic_master', None):
|
||||
@ -434,7 +434,7 @@ def create(vm_):
|
||||
win_installer = config.get_config_value('win_installer', vm_, __opts__)
|
||||
if win_installer:
|
||||
deploy_kwargs['win_installer'] = win_installer
|
||||
minion = salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
minion = salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
deploy_kwargs['master'] = minion['master']
|
||||
deploy_kwargs['username'] = config.get_config_value(
|
||||
'win_username', vm_, __opts__, default='Administrator'
|
||||
@ -452,7 +452,7 @@ def create(vm_):
|
||||
del(event_kwargs['password'])
|
||||
ret['deploy_kwargs'] = event_kwargs
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'executing deploy script',
|
||||
'salt/cloud/{0}/deploying'.format(vm_['name']),
|
||||
@ -461,9 +461,9 @@ def create(vm_):
|
||||
|
||||
deployed = False
|
||||
if win_installer:
|
||||
deployed = salt.cloud.utils.deploy_windows(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_windows(**deploy_kwargs)
|
||||
else:
|
||||
deployed = salt.cloud.utils.deploy_script(**deploy_kwargs)
|
||||
deployed = salt.utils.cloud.deploy_script(**deploy_kwargs)
|
||||
|
||||
if deployed:
|
||||
log.info('Salt installed on {0}'.format(vm_['name']))
|
||||
@ -483,7 +483,7 @@ def create(vm_):
|
||||
|
||||
ret.update(response)
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'created instance',
|
||||
'salt/cloud/{0}/created'.format(vm_['name']),
|
||||
@ -581,7 +581,7 @@ def destroy(name, call=None):
|
||||
|
||||
salt-cloud --destroy mymachine
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -592,7 +592,7 @@ def destroy(name, call=None):
|
||||
conn = get_conn()
|
||||
response = conn.deleteObject(id=node['id'])
|
||||
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
|
@ -26,7 +26,7 @@ import salt._compat
|
||||
import salt.utils.event
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.cloud.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.cloud.exceptions import SaltCloudNotFound, SaltCloudSystemExit
|
||||
|
||||
@ -266,12 +266,12 @@ def script(vm_):
|
||||
Return the script deployment object
|
||||
'''
|
||||
return ScriptDeployment(
|
||||
salt.cloud.utils.os_script(
|
||||
salt.utils.cloud.os_script(
|
||||
config.get_config_value('os', vm_, __opts__),
|
||||
vm_,
|
||||
__opts__,
|
||||
salt.cloud.utils.salt_config_to_yaml(
|
||||
salt.cloud.utils.minion_config(__opts__, vm_)
|
||||
salt.utils.cloud.salt_config_to_yaml(
|
||||
salt.utils.cloud.minion_config(__opts__, vm_)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -281,7 +281,7 @@ def destroy(name, conn=None):
|
||||
'''
|
||||
Delete a single VM
|
||||
'''
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroying instance',
|
||||
'salt/cloud/{0}/destroying'.format(name),
|
||||
@ -300,14 +300,14 @@ def destroy(name, conn=None):
|
||||
log.info('Destroyed VM: {0}'.format(name))
|
||||
# Fire destroy action
|
||||
event = salt.utils.event.SaltEvent('master', __opts__['sock_dir'])
|
||||
salt.cloud.utils.fire_event(
|
||||
salt.utils.cloud.fire_event(
|
||||
'event',
|
||||
'destroyed instance',
|
||||
'salt/cloud/{0}/destroyed'.format(name),
|
||||
{'name': name},
|
||||
)
|
||||
if __opts__['delete_sshkeys'] is True:
|
||||
salt.cloud.utils.remove_sshkey(node.public_ips[0])
|
||||
salt.utils.cloud.remove_sshkey(node.public_ips[0])
|
||||
return True
|
||||
|
||||
log.error('Failed to Destroy VM: {0}'.format(name))
|
||||
|
@ -399,7 +399,7 @@ def deploy_windows(host, port=445, timeout=900, username='Administrator',
|
||||
# Let's not just fail regarding this change, specially
|
||||
# since we can handle it
|
||||
raise DeprecationWarning(
|
||||
'`salt.cloud.utils.deploy_windows` now only accepts '
|
||||
'`salt.utils.cloud.deploy_windows` now only accepts '
|
||||
'dictionaries for its `minion_conf` parameter. '
|
||||
'Loading YAML...'
|
||||
)
|
||||
@ -558,7 +558,7 @@ def deploy_script(host, port=22, timeout=900, username='root',
|
||||
# Let's not just fail regarding this change, specially
|
||||
# since we can handle it
|
||||
raise DeprecationWarning(
|
||||
'`salt.cloud.utils.deploy_script now only accepts '
|
||||
'`salt.utils.cloud.deploy_script now only accepts '
|
||||
'dictionaries for it\'s `minion_conf` parameter. '
|
||||
'Loading YAML...'
|
||||
)
|
||||
@ -589,7 +589,7 @@ def deploy_script(host, port=22, timeout=900, username='root',
|
||||
# Let's not just fail regarding this change, specially
|
||||
# since we can handle it
|
||||
raise DeprecationWarning(
|
||||
'`salt.cloud.utils.deploy_script now only accepts '
|
||||
'`salt.utils.cloud.deploy_script now only accepts '
|
||||
'dictionaries for it\'s `master_conf` parameter. '
|
||||
'Loading from YAML ...'
|
||||
)
|
Loading…
Reference in New Issue
Block a user