mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2016.11' into '2017.7'
Conflicts: - salt/utils/cloud.py
This commit is contained in:
commit
cb50cce181
2 changed files with 18 additions and 14 deletions
|
@ -801,17 +801,17 @@ def mod_repo(repo, **kwargs):
|
|||
the URL for zypper to reference
|
||||
|
||||
enabled
|
||||
enable or disable (True or False) repository,
|
||||
Enable or disable (True or False) repository,
|
||||
but do not remove if disabled.
|
||||
|
||||
refresh
|
||||
enable or disable (True or False) auto-refresh of the repository.
|
||||
Enable or disable (True or False) auto-refresh of the repository.
|
||||
|
||||
cache
|
||||
Enable or disable (True or False) RPM files caching.
|
||||
|
||||
gpgcheck
|
||||
Enable or disable (True or False) GOG check for this repository.
|
||||
Enable or disable (True or False) GPG check for this repository.
|
||||
|
||||
gpgautoimport
|
||||
Automatically trust and import new repository.
|
||||
|
|
|
@ -89,6 +89,10 @@ try:
|
|||
except ImportError:
|
||||
HAS_GETPASS = False
|
||||
|
||||
# This is required to support international characters in AWS EC2 tags or any
|
||||
# other kind of metadata provided by particular Cloud vendor.
|
||||
MSGPACK_ENCODING = 'utf-8'
|
||||
|
||||
NSTATES = {
|
||||
0: 'running',
|
||||
1: 'rebooting',
|
||||
|
@ -2557,7 +2561,7 @@ def cachedir_index_add(minion_id, profile, driver, provider, base=None):
|
|||
if os.path.exists(index_file):
|
||||
mode = 'rb' if six.PY3 else 'r'
|
||||
with salt.utils.fopen(index_file, mode) as fh_:
|
||||
index = msgpack.load(fh_)
|
||||
index = msgpack.load(fh_, encoding=MSGPACK_ENCODING)
|
||||
else:
|
||||
index = {}
|
||||
|
||||
|
@ -2574,7 +2578,7 @@ def cachedir_index_add(minion_id, profile, driver, provider, base=None):
|
|||
|
||||
mode = 'wb' if six.PY3 else 'w'
|
||||
with salt.utils.fopen(index_file, mode) as fh_:
|
||||
msgpack.dump(index, fh_)
|
||||
msgpack.dump(index, fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
unlock_file(index_file)
|
||||
|
||||
|
@ -2591,7 +2595,7 @@ def cachedir_index_del(minion_id, base=None):
|
|||
if os.path.exists(index_file):
|
||||
mode = 'rb' if six.PY3 else 'r'
|
||||
with salt.utils.fopen(index_file, mode) as fh_:
|
||||
index = msgpack.load(fh_)
|
||||
index = msgpack.load(fh_, encoding=MSGPACK_ENCODING)
|
||||
else:
|
||||
return
|
||||
|
||||
|
@ -2600,7 +2604,7 @@ def cachedir_index_del(minion_id, base=None):
|
|||
|
||||
mode = 'wb' if six.PY3 else 'w'
|
||||
with salt.utils.fopen(index_file, mode) as fh_:
|
||||
msgpack.dump(index, fh_)
|
||||
msgpack.dump(index, fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
unlock_file(index_file)
|
||||
|
||||
|
@ -2658,7 +2662,7 @@ def request_minion_cachedir(
|
|||
path = os.path.join(base, 'requested', fname)
|
||||
mode = 'wb' if six.PY3 else 'w'
|
||||
with salt.utils.fopen(path, mode) as fh_:
|
||||
msgpack.dump(data, fh_)
|
||||
msgpack.dump(data, fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
|
||||
def change_minion_cachedir(
|
||||
|
@ -2690,12 +2694,12 @@ def change_minion_cachedir(
|
|||
path = os.path.join(base, cachedir, fname)
|
||||
|
||||
with salt.utils.fopen(path, 'r') as fh_:
|
||||
cache_data = msgpack.load(fh_)
|
||||
cache_data = msgpack.load(fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
cache_data.update(data)
|
||||
|
||||
with salt.utils.fopen(path, 'w') as fh_:
|
||||
msgpack.dump(cache_data, fh_)
|
||||
msgpack.dump(cache_data, fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
|
||||
def activate_minion_cachedir(minion_id, base=None):
|
||||
|
@ -2769,7 +2773,7 @@ def list_cache_nodes_full(opts=None, provider=None, base=None):
|
|||
minion_id = fname[:-2] # strip '.p' from end of msgpack filename
|
||||
mode = 'rb' if six.PY3 else 'r'
|
||||
with salt.utils.fopen(fpath, mode) as fh_:
|
||||
minions[driver][prov][minion_id] = msgpack.load(fh_, encoding='utf-8')
|
||||
minions[driver][prov][minion_id] = msgpack.load(fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
return minions
|
||||
|
||||
|
@ -2949,7 +2953,7 @@ def cache_node_list(nodes, provider, opts):
|
|||
path = os.path.join(prov_dir, '{0}.p'.format(node))
|
||||
mode = 'wb' if six.PY3 else 'w'
|
||||
with salt.utils.fopen(path, mode) as fh_:
|
||||
msgpack.dump(nodes[node], fh_)
|
||||
msgpack.dump(nodes[node], fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
|
||||
def cache_node(node, provider, opts):
|
||||
|
@ -2975,7 +2979,7 @@ def cache_node(node, provider, opts):
|
|||
path = os.path.join(prov_dir, '{0}.p'.format(node['name']))
|
||||
mode = 'wb' if six.PY3 else 'w'
|
||||
with salt.utils.fopen(path, mode) as fh_:
|
||||
msgpack.dump(node, fh_)
|
||||
msgpack.dump(node, fh_, encoding=MSGPACK_ENCODING)
|
||||
|
||||
|
||||
def missing_node_cache(prov_dir, node_list, provider, opts):
|
||||
|
@ -3050,7 +3054,7 @@ def diff_node_cache(prov_dir, node, new_data, opts):
|
|||
|
||||
with salt.utils.fopen(path, 'r') as fh_:
|
||||
try:
|
||||
cache_data = msgpack.load(fh_)
|
||||
cache_data = msgpack.load(fh_, encoding=MSGPACK_ENCODING)
|
||||
except ValueError:
|
||||
log.warning('Cache for {0} was corrupt: Deleting'.format(node))
|
||||
cache_data = {}
|
||||
|
|
Loading…
Add table
Reference in a new issue