mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2015.8' into '2016.3'
Conflicts: - salt/utils/cloud.py
This commit is contained in:
commit
bb4605ffee
5 changed files with 32 additions and 22 deletions
|
@ -4599,7 +4599,7 @@ def _parse_pricing(url, name):
|
|||
regions[region['region']] = sizes
|
||||
|
||||
outfile = os.path.join(
|
||||
__opts__['cachedir'], 'cloud', 'ec2-pricing-{0}.p'.format(name)
|
||||
__opts__['cachedir'], 'ec2-pricing-{0}.p'.format(name)
|
||||
)
|
||||
with salt.utils.fopen(outfile, 'w') as fho:
|
||||
msgpack.dump(regions, fho)
|
||||
|
@ -4663,7 +4663,7 @@ def show_pricing(kwargs=None, call=None):
|
|||
name = 'linux'
|
||||
|
||||
pricefile = os.path.join(
|
||||
__opts__['cachedir'], 'cloud', 'ec2-pricing-{0}.p'.format(name)
|
||||
__opts__['cachedir'], 'ec2-pricing-{0}.p'.format(name)
|
||||
)
|
||||
|
||||
if not os.path.isfile(pricefile):
|
||||
|
|
|
@ -2166,7 +2166,7 @@ def update_pricing(kwargs=None, call=None):
|
|||
price_json = http.query(url, decode=True, decode_type='json')
|
||||
|
||||
outfile = os.path.join(
|
||||
__opts__['cachedir'], 'cloud', 'gce-pricing.p'
|
||||
__opts__['cachedir'], 'gce-pricing.p'
|
||||
)
|
||||
with salt.utils.fopen(outfile, 'w') as fho:
|
||||
msgpack.dump(price_json['dict'], fho)
|
||||
|
@ -2202,7 +2202,7 @@ def show_pricing(kwargs=None, call=None):
|
|||
|
||||
size = 'CP-COMPUTEENGINE-VMIMAGE-{0}'.format(profile['size'].upper())
|
||||
pricefile = os.path.join(
|
||||
__opts__['cachedir'], 'cloud', 'gce-pricing.p'
|
||||
__opts__['cachedir'], 'gce-pricing.p'
|
||||
)
|
||||
if not os.path.exists(pricefile):
|
||||
update_pricing()
|
||||
|
|
|
@ -1361,6 +1361,7 @@ CLOUD_CONFIG_DEFAULTS = {
|
|||
'default_include': 'cloud.conf.d/*.conf',
|
||||
# Global defaults
|
||||
'ssh_auth': '',
|
||||
'cachedir': os.path.join(salt.syspaths.CACHE_DIR, 'cloud'),
|
||||
'keysize': 4096,
|
||||
'os': '',
|
||||
'script': 'bootstrap-salt',
|
||||
|
@ -1906,17 +1907,18 @@ def cloud_config(path, env_var='SALT_CLOUD_CONFIG', defaults=None,
|
|||
'''
|
||||
Read in the salt cloud config and return the dict
|
||||
'''
|
||||
# Load the cloud configuration
|
||||
overrides = load_config(
|
||||
path,
|
||||
env_var,
|
||||
os.path.join(salt.syspaths.CONFIG_DIR, 'cloud')
|
||||
)
|
||||
if path:
|
||||
config_dir = os.path.dirname(path)
|
||||
else:
|
||||
config_dir = salt.syspaths.CONFIG_DIR
|
||||
|
||||
# Load the cloud configuration
|
||||
overrides = load_config(
|
||||
path,
|
||||
env_var,
|
||||
os.path.join(config_dir, 'cloud')
|
||||
)
|
||||
|
||||
if defaults is None:
|
||||
defaults = CLOUD_CONFIG_DEFAULTS
|
||||
|
||||
|
@ -2030,6 +2032,9 @@ def cloud_config(path, env_var='SALT_CLOUD_CONFIG', defaults=None,
|
|||
elif master_config_path is not None and master_config is None:
|
||||
master_config = salt.config.master_config(master_config_path)
|
||||
|
||||
# cloud config has a seperate cachedir
|
||||
del master_config['cachedir']
|
||||
|
||||
# 2nd - salt-cloud configuration which was loaded before so we could
|
||||
# extract the master configuration file if needed.
|
||||
|
||||
|
@ -2112,6 +2117,10 @@ def cloud_config(path, env_var='SALT_CLOUD_CONFIG', defaults=None,
|
|||
# recurse opts for sdb configs
|
||||
apply_sdb(opts)
|
||||
|
||||
# prepend root_dir
|
||||
prepend_root_dirs = ['cachedir']
|
||||
prepend_root_dir(opts, prepend_root_dirs)
|
||||
|
||||
# Return the final options
|
||||
return opts
|
||||
|
||||
|
|
|
@ -1203,9 +1203,10 @@ class AESFuncs(object):
|
|||
|
||||
if len(load['data']) + load.get('loc', 0) > file_recv_max_size:
|
||||
log.error(
|
||||
'Exceeding file_recv_max_size limit: {0}'.format(
|
||||
file_recv_max_size
|
||||
)
|
||||
'file_recv_max_size limit of %d MB exceeded! %s will be '
|
||||
'truncated. To successfully push this file, adjust '
|
||||
'file_recv_max_size to an integer (in MB) large enough to '
|
||||
'accommodate it.', file_recv_max_size, load['path']
|
||||
)
|
||||
return False
|
||||
if 'tok' not in load:
|
||||
|
|
|
@ -2525,7 +2525,7 @@ def init_cachedir(base=None):
|
|||
Initialize the cachedir needed for Salt Cloud to keep track of minions
|
||||
'''
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
needed_dirs = (base,
|
||||
os.path.join(base, 'requested'),
|
||||
os.path.join(base, 'active'))
|
||||
|
@ -2555,7 +2555,7 @@ def request_minion_cachedir(
|
|||
will be set to None.
|
||||
'''
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
|
||||
if not fingerprint and pubkey is not None:
|
||||
fingerprint = salt.utils.pem_finger(key=pubkey, sum_type=(opts and opts.get('hash_type') or 'sha256'))
|
||||
|
@ -2597,7 +2597,7 @@ def change_minion_cachedir(
|
|||
return False
|
||||
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
|
||||
fname = '{0}.p'.format(minion_id)
|
||||
path = os.path.join(base, cachedir, fname)
|
||||
|
@ -2618,7 +2618,7 @@ def activate_minion_cachedir(minion_id, base=None):
|
|||
exists, and should be expected to exist from here on out.
|
||||
'''
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
|
||||
fname = '{0}.p'.format(minion_id)
|
||||
src = os.path.join(base, 'requested', fname)
|
||||
|
@ -2636,7 +2636,7 @@ def delete_minion_cachedir(minion_id, provider, opts, base=None):
|
|||
return
|
||||
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
|
||||
driver = next(six.iterkeys(opts['providers'][provider]))
|
||||
fname = '{0}.p'.format(minion_id)
|
||||
|
@ -2656,7 +2656,7 @@ def list_cache_nodes_full(opts, provider=None, base=None):
|
|||
return
|
||||
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud', 'active')
|
||||
base = os.path.join(__opts__['cachedir'], 'active')
|
||||
|
||||
minions = {}
|
||||
# First, get a list of all drivers in use
|
||||
|
@ -2687,7 +2687,7 @@ def cache_nodes_ip(opts, base=None):
|
|||
addresses. Returns a dict.
|
||||
'''
|
||||
if base is None:
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud')
|
||||
base = __opts__['cachedir']
|
||||
|
||||
minions = list_cache_nodes_full(opts, base=base)
|
||||
|
||||
|
@ -2867,10 +2867,10 @@ def cache_node(node, provider, opts):
|
|||
if 'update_cachedir' not in opts or not opts['update_cachedir']:
|
||||
return
|
||||
|
||||
base = os.path.join(__opts__['cachedir'], 'cloud', 'active')
|
||||
if not os.path.exists(base):
|
||||
if not os.path.exists(os.path.join(__opts__['cachedir'], 'active')):
|
||||
init_cachedir()
|
||||
|
||||
base = os.path.join(__opts__['cachedir'], 'active')
|
||||
provider, driver = provider.split(':')
|
||||
prov_dir = os.path.join(base, driver, provider)
|
||||
if not os.path.exists(prov_dir):
|
||||
|
|
Loading…
Add table
Reference in a new issue