mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Merge branch '2016.11' into 'nitrogen'
No conflicts.
This commit is contained in:
commit
bdf33d7f5f
@ -18,18 +18,6 @@ Generic Troubleshooting Steps
|
||||
This section describes a set of instructions that are useful to a large number
|
||||
of situations, and are likely to solve most issues that arise.
|
||||
|
||||
.. admonition:: Version Compatibility
|
||||
|
||||
One of the most common issues that Salt Cloud users run into is import
|
||||
errors. These are often caused by version compatibility issues with Salt.
|
||||
|
||||
Salt 0.16.x works with Salt Cloud 0.8.9 or greater.
|
||||
|
||||
Salt 0.17.x requires Salt Cloud 0.8.11.
|
||||
|
||||
Releases after 0.17.x (0.18 or greater) should not encounter issues as Salt
|
||||
Cloud has been merged into Salt itself.
|
||||
|
||||
Debug Mode
|
||||
----------
|
||||
Frequently, running Salt Cloud in debug mode will reveal information about a
|
||||
|
@ -89,6 +89,6 @@ bare-bones example:
|
||||
.. note::
|
||||
If a master_tops module returns :ref:`top file <states-top>` data for a
|
||||
given minion, it will be added to the states configured in the top file. It
|
||||
will *not* replace it altogether. The Nitrogen release adds additional
|
||||
will *not* replace it altogether. The Oxygen release adds additional
|
||||
functionality allowing a minion to treat master_tops as the single source
|
||||
of truth, irrespective of the top file.
|
||||
|
@ -671,6 +671,7 @@ class LocalClient(object):
|
||||
* ``nodegroup`` - Match on nodegroup
|
||||
* ``range`` - Use a Range server for matching
|
||||
* ``compound`` - Pass a compound match string
|
||||
* ``ipcidr`` - Match based on Subnet (CIDR notation) or IPv4 address.
|
||||
|
||||
.. versionchanged:: Nitrogen
|
||||
Renamed from ``expr_form`` to ``tgt_type``
|
||||
|
@ -387,7 +387,7 @@ def _file_lists(load, form):
|
||||
# Only count the link if it does not point
|
||||
# outside of the root dir of the fileserver
|
||||
# (i.e. the "path" variable)
|
||||
ret['links'][rel_path] = rel_dest
|
||||
ret['links'][rel_path] = link_dest
|
||||
|
||||
for path in __opts__['file_roots'][load['saltenv']]:
|
||||
for root, dirs, files in os.walk(
|
||||
|
@ -4053,7 +4053,7 @@ def extract_hash(hash_fn,
|
||||
hash_matched = True
|
||||
except IndexError:
|
||||
pass
|
||||
elif re.match(source_hash_name.replace('.', r'\.') + r'\s+',
|
||||
elif re.match(re.escape(source_hash_name) + r'\s+',
|
||||
line):
|
||||
_add_to_matches(found, line, 'source_hash_name',
|
||||
source_hash_name, matched)
|
||||
@ -4071,7 +4071,7 @@ def extract_hash(hash_fn,
|
||||
hash_matched = True
|
||||
except IndexError:
|
||||
pass
|
||||
elif re.match(file_name.replace('.', r'\.') + r'\s+', line):
|
||||
elif re.match(re.escape(file_name) + r'\s+', line):
|
||||
_add_to_matches(found, line, 'file_name',
|
||||
file_name, matched)
|
||||
hash_matched = True
|
||||
@ -4085,7 +4085,7 @@ def extract_hash(hash_fn,
|
||||
hash_matched = True
|
||||
except IndexError:
|
||||
pass
|
||||
elif re.match(source.replace('.', r'\.') + r'\s+', line):
|
||||
elif re.match(re.escape(source) + r'\s+', line):
|
||||
_add_to_matches(found, line, 'source', source, matched)
|
||||
hash_matched = True
|
||||
|
||||
|
@ -324,7 +324,7 @@ def list_(pkg=None, dir=None, runas=None, env=None, depth=None):
|
||||
return json.loads(result['stdout']).get('dependencies', {})
|
||||
|
||||
|
||||
def cache_clean(path=None, runas=None, env=None):
|
||||
def cache_clean(path=None, runas=None, env=None, force=False):
|
||||
'''
|
||||
Clean cached NPM packages.
|
||||
|
||||
@ -341,11 +341,16 @@ def cache_clean(path=None, runas=None, env=None):
|
||||
format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
|
||||
function.
|
||||
|
||||
force
|
||||
Force cleaning of cache. Required for npm@5 and greater
|
||||
|
||||
.. versionadded:: 2016.11.6
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' npm.cache_clean
|
||||
salt '*' npm.cache_clean force=True
|
||||
|
||||
'''
|
||||
env = env or {}
|
||||
@ -358,6 +363,8 @@ def cache_clean(path=None, runas=None, env=None):
|
||||
cmd = ['npm', 'cache', 'clean']
|
||||
if path:
|
||||
cmd.append(path)
|
||||
if force is True:
|
||||
cmd.append('--force')
|
||||
|
||||
cmd = ' '.join(cmd)
|
||||
result = __salt__['cmd.run_all'](
|
||||
|
@ -377,16 +377,19 @@ def mkfs(device, fs_type):
|
||||
_validate_device(device)
|
||||
|
||||
if fs_type not in set(['ext2', 'fat32', 'fat16', 'linux-swap', 'reiserfs',
|
||||
'hfs', 'hfs+', 'hfsx', 'NTFS', 'ufs']):
|
||||
'hfs', 'hfs+', 'hfsx', 'NTFS', 'ntfs', 'ufs']):
|
||||
raise CommandExecutionError('Invalid fs_type passed to partition.mkfs')
|
||||
|
||||
if fs_type is 'linux-swap':
|
||||
if fs_type == 'NTFS':
|
||||
fs_type = 'ntfs'
|
||||
|
||||
if fs_type == 'linux-swap':
|
||||
mkfs_cmd = 'mkswap'
|
||||
else:
|
||||
mkfs_cmd = 'mkfs.{0}'.format(fs_type)
|
||||
|
||||
if not salt.utils.which(mkfs_cmd):
|
||||
return 'Error: {0} is unavailable.'
|
||||
return 'Error: {0} is unavailable.'.format(mkfs_cmd)
|
||||
cmd = '{0} {1}'.format(mkfs_cmd, device)
|
||||
out = __salt__['cmd.run'](cmd).splitlines()
|
||||
return out
|
||||
|
@ -309,7 +309,8 @@ def bootstrap(name, user=None, silent=True):
|
||||
|
||||
|
||||
def cache_cleaned(name=None,
|
||||
user=None):
|
||||
user=None,
|
||||
force=False):
|
||||
'''
|
||||
Ensure that the given package is not cached.
|
||||
|
||||
@ -320,6 +321,11 @@ def cache_cleaned(name=None,
|
||||
|
||||
user
|
||||
The user to run NPM with
|
||||
|
||||
force
|
||||
Force cleaning of cache. Required for npm@5 and greater
|
||||
|
||||
.. versionadded:: 2016.11.6
|
||||
'''
|
||||
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
|
||||
specific_pkg = None
|
||||
|
@ -58,5 +58,5 @@ class NpmStateTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
'''
|
||||
Basic test to determine if NPM successfully cleans its cached packages.
|
||||
'''
|
||||
ret = self.run_state('npm.cache_cleaned', name=None)
|
||||
ret = self.run_state('npm.cache_cleaned', name=None, force=True)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
Loading…
Reference in New Issue
Block a user