mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #44103 from terminalmage/salt.utils
Complete the salt.utils refactor
This commit is contained in:
commit
413de95df2
@ -146,24 +146,24 @@ library. The following two lines set up the imports:
|
||||
.. code-block:: python
|
||||
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
import salt.utils
|
||||
import salt.utils.functools
|
||||
|
||||
And then a series of declarations will make the necessary functions available
|
||||
within the cloud module.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
get_size = salt.utils.namespaced_function(get_size, globals())
|
||||
get_image = salt.utils.namespaced_function(get_image, globals())
|
||||
avail_locations = salt.utils.namespaced_function(avail_locations, globals())
|
||||
avail_images = salt.utils.namespaced_function(avail_images, globals())
|
||||
avail_sizes = salt.utils.namespaced_function(avail_sizes, globals())
|
||||
script = salt.utils.namespaced_function(script, globals())
|
||||
destroy = salt.utils.namespaced_function(destroy, globals())
|
||||
list_nodes = salt.utils.namespaced_function(list_nodes, globals())
|
||||
list_nodes_full = salt.utils.namespaced_function(list_nodes_full, globals())
|
||||
list_nodes_select = salt.utils.namespaced_function(list_nodes_select, globals())
|
||||
show_instance = salt.utils.namespaced_function(show_instance, globals())
|
||||
get_size = salt.utils.functools.namespaced_function(get_size, globals())
|
||||
get_image = salt.utils.functools.namespaced_function(get_image, globals())
|
||||
avail_locations = salt.utils.functools.namespaced_function(avail_locations, globals())
|
||||
avail_images = salt.utils.functools.namespaced_function(avail_images, globals())
|
||||
avail_sizes = salt.utils.functools.namespaced_function(avail_sizes, globals())
|
||||
script = salt.utils.functools.namespaced_function(script, globals())
|
||||
destroy = salt.utils.functools.namespaced_function(destroy, globals())
|
||||
list_nodes = salt.utils.functools.namespaced_function(list_nodes, globals())
|
||||
list_nodes_full = salt.utils.functools.namespaced_function(list_nodes_full, globals())
|
||||
list_nodes_select = salt.utils.functools.namespaced_function(list_nodes_select, globals())
|
||||
show_instance = salt.utils.functools.namespaced_function(show_instance, globals())
|
||||
|
||||
If necessary, these functions may be replaced by removing the appropriate
|
||||
declaration line, and then adding the function as normal.
|
||||
|
@ -12,7 +12,7 @@ found by reading the salt documentation:
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.stringutils
|
||||
|
||||
# Import 3rd-party libs
|
||||
from salt.ext import six
|
||||
@ -31,13 +31,13 @@ class PublisherACL(object):
|
||||
Takes a username as a string and returns a boolean. True indicates that
|
||||
the provided user has been blacklisted
|
||||
'''
|
||||
return not salt.utils.check_whitelist_blacklist(user, blacklist=self.blacklist.get('users', []))
|
||||
return not salt.utils.stringutils.check_whitelist_blacklist(user, blacklist=self.blacklist.get('users', []))
|
||||
|
||||
def cmd_is_blacklisted(self, cmd):
|
||||
# If this is a regular command, it is a single function
|
||||
if isinstance(cmd, six.string_types):
|
||||
cmd = [cmd]
|
||||
for fun in cmd:
|
||||
if not salt.utils.check_whitelist_blacklist(fun, blacklist=self.blacklist.get('modules', [])):
|
||||
if not salt.utils.stringutils.check_whitelist_blacklist(fun, blacklist=self.blacklist.get('modules', [])):
|
||||
return True
|
||||
return False
|
||||
|
@ -28,12 +28,12 @@ from salt.ext.six.moves import input
|
||||
import salt.config
|
||||
import salt.loader
|
||||
import salt.transport.client
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.dictupdate
|
||||
import salt.utils.files
|
||||
import salt.utils.minions
|
||||
import salt.utils.versions
|
||||
import salt.utils.user
|
||||
import salt.utils.versions
|
||||
import salt.utils.zeromq
|
||||
import salt.payload
|
||||
|
||||
@ -89,9 +89,10 @@ class LoadAuth(object):
|
||||
fstr = '{0}.auth'.format(load['eauth'])
|
||||
if fstr not in self.auth:
|
||||
return False
|
||||
fcall = salt.utils.format_call(self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
fcall = salt.utils.args.format_call(
|
||||
self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
try:
|
||||
if 'kwargs' in fcall:
|
||||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
@ -135,9 +136,10 @@ class LoadAuth(object):
|
||||
fstr = '{0}.acl'.format(mod)
|
||||
if fstr not in self.auth:
|
||||
return None
|
||||
fcall = salt.utils.format_call(self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
fcall = salt.utils.args.format_call(
|
||||
self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
try:
|
||||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
except Exception as e:
|
||||
@ -170,9 +172,10 @@ class LoadAuth(object):
|
||||
fstr = '{0}.groups'.format(load['eauth'])
|
||||
if fstr not in self.auth:
|
||||
return False
|
||||
fcall = salt.utils.format_call(self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
fcall = salt.utils.args.format_call(
|
||||
self.auth[fstr],
|
||||
load,
|
||||
expected_extra_kws=AUTH_INTERNAL_KEYWORDS)
|
||||
try:
|
||||
return self.auth[fstr](*fcall['args'], **fcall['kwargs'])
|
||||
except IndexError:
|
||||
|
@ -10,7 +10,7 @@ import re
|
||||
|
||||
# Import Salt libs
|
||||
import salt.loader
|
||||
import salt.utils
|
||||
import salt.utils.event
|
||||
import salt.utils.minion
|
||||
from salt.ext.six.moves import map
|
||||
from salt.exceptions import CommandExecutionError
|
||||
|
@ -7,7 +7,7 @@ A simple beacon to watch journald for specific entries
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
import salt.utils.locales
|
||||
import salt.ext.six
|
||||
from salt.ext.six.moves import map
|
||||
@ -99,7 +99,7 @@ def beacon(config):
|
||||
n_flag += 1
|
||||
if n_flag == len(_config['services'][name]):
|
||||
# Match!
|
||||
sub = salt.utils.simple_types_filter(cur)
|
||||
sub = salt.utils.data.simple_types_filter(cur)
|
||||
sub.update({'tag': name})
|
||||
ret.append(sub)
|
||||
return ret
|
||||
|
@ -8,7 +8,6 @@ from __future__ import absolute_import
|
||||
import time
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
import salt.utils.vt
|
||||
|
||||
|
1
salt/cache/localfs.py
vendored
1
salt/cache/localfs.py
vendored
@ -18,7 +18,6 @@ import shutil
|
||||
import tempfile
|
||||
|
||||
from salt.exceptions import SaltCacheError
|
||||
import salt.utils
|
||||
import salt.utils.atomicfile
|
||||
import salt.utils.files
|
||||
|
||||
|
@ -11,7 +11,7 @@ import copy
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once print_cli is moved
|
||||
import salt.utils.stringutils
|
||||
import salt.client
|
||||
import salt.output
|
||||
import salt.exceptions
|
||||
@ -73,7 +73,7 @@ class Batch(object):
|
||||
m = next(six.iterkeys(ret))
|
||||
except StopIteration:
|
||||
if not self.quiet:
|
||||
salt.utils.print_cli('No minions matched the target.')
|
||||
salt.utils.stringutils.print_cli('No minions matched the target.')
|
||||
break
|
||||
if m is not None:
|
||||
fret.add(m)
|
||||
@ -95,7 +95,7 @@ class Batch(object):
|
||||
return int(self.opts['batch'])
|
||||
except ValueError:
|
||||
if not self.quiet:
|
||||
salt.utils.print_cli('Invalid batch data sent: {0}\nData must be in the '
|
||||
salt.utils.stringutils.print_cli('Invalid batch data sent: {0}\nData must be in the '
|
||||
'form of %10, 10% or 3'.format(self.opts['batch']))
|
||||
|
||||
def __update_wait(self, wait):
|
||||
@ -147,7 +147,7 @@ class Batch(object):
|
||||
# We already know some minions didn't respond to the ping, so inform
|
||||
# the user we won't be attempting to run a job on them
|
||||
for down_minion in self.down_minions:
|
||||
salt.utils.print_cli('Minion {0} did not respond. No job will be sent.'.format(down_minion))
|
||||
salt.utils.stringutils.print_cli('Minion {0} did not respond. No job will be sent.'.format(down_minion))
|
||||
|
||||
# Iterate while we still have things to execute
|
||||
while len(ret) < len(self.minions):
|
||||
@ -172,7 +172,7 @@ class Batch(object):
|
||||
|
||||
if next_:
|
||||
if not self.quiet:
|
||||
salt.utils.print_cli('\nExecuting run on {0}\n'.format(sorted(next_)))
|
||||
salt.utils.stringutils.print_cli('\nExecuting run on {0}\n'.format(sorted(next_)))
|
||||
# create a new iterator for this batch of minions
|
||||
new_iter = self.local.cmd_iter_no_block(
|
||||
*args,
|
||||
@ -219,14 +219,14 @@ class Batch(object):
|
||||
if part['data']['id'] in minion_tracker[queue]['minions']:
|
||||
minion_tracker[queue]['minions'].remove(part['data']['id'])
|
||||
else:
|
||||
salt.utils.print_cli('minion {0} was already deleted from tracker, probably a duplicate key'.format(part['id']))
|
||||
salt.utils.stringutils.print_cli('minion {0} was already deleted from tracker, probably a duplicate key'.format(part['id']))
|
||||
else:
|
||||
parts.update(part)
|
||||
for id in part:
|
||||
if id in minion_tracker[queue]['minions']:
|
||||
minion_tracker[queue]['minions'].remove(id)
|
||||
else:
|
||||
salt.utils.print_cli('minion {0} was already deleted from tracker, probably a duplicate key'.format(id))
|
||||
salt.utils.stringutils.print_cli('minion {0} was already deleted from tracker, probably a duplicate key'.format(id))
|
||||
except StopIteration:
|
||||
# if a iterator is done:
|
||||
# - set it to inactive
|
||||
|
@ -20,12 +20,13 @@ import salt.minion
|
||||
import salt.output
|
||||
import salt.payload
|
||||
import salt.transport
|
||||
import salt.utils # TODO: Remove this once print_cli, activate_profile, and output_profile are moved
|
||||
import salt.utils.args
|
||||
import salt.utils.files
|
||||
import salt.utils.jid
|
||||
import salt.utils.kinds as kinds
|
||||
import salt.utils.minion
|
||||
import salt.utils.profile
|
||||
import salt.utils.stringutils
|
||||
import salt.defaults.exitcodes
|
||||
from salt.cli import daemons
|
||||
from salt.log import LOG_LEVELS
|
||||
@ -113,7 +114,7 @@ class BaseCaller(object):
|
||||
docs[name] = func.__doc__
|
||||
for name in sorted(docs):
|
||||
if name.startswith(self.opts.get('fun', '')):
|
||||
salt.utils.print_cli('{0}:\n{1}\n'.format(name, docs[name]))
|
||||
salt.utils.stringutils.print_cli('{0}:\n{1}\n'.format(name, docs[name]))
|
||||
|
||||
def print_grains(self):
|
||||
'''
|
||||
@ -128,11 +129,11 @@ class BaseCaller(object):
|
||||
'''
|
||||
profiling_enabled = self.opts.get('profiling_enabled', False)
|
||||
try:
|
||||
pr = salt.utils.activate_profile(profiling_enabled)
|
||||
pr = salt.utils.profile.activate_profile(profiling_enabled)
|
||||
try:
|
||||
ret = self.call()
|
||||
finally:
|
||||
salt.utils.output_profile(
|
||||
salt.utils.profile.output_profile(
|
||||
pr,
|
||||
stats_path=self.opts.get('profiling_path', '/tmp/stats'),
|
||||
stop=True)
|
||||
@ -209,7 +210,7 @@ class BaseCaller(object):
|
||||
ret['return'] = func(*args, **kwargs)
|
||||
except TypeError as exc:
|
||||
sys.stderr.write('\nPassed invalid arguments: {0}.\n\nUsage:\n'.format(exc))
|
||||
salt.utils.print_cli(func.__doc__)
|
||||
salt.utils.stringutils.print_cli(func.__doc__)
|
||||
active_level = LOG_LEVELS.get(
|
||||
self.opts['log_level'].lower(), logging.ERROR)
|
||||
if active_level <= logging.DEBUG:
|
||||
|
@ -19,7 +19,6 @@ import sys
|
||||
# Import salt libs
|
||||
import salt.client
|
||||
import salt.output
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.itertools
|
||||
@ -127,9 +126,10 @@ class SaltCP(object):
|
||||
if os.path.isfile(fn_):
|
||||
files.update(self._file_dict(fn_))
|
||||
elif os.path.isdir(fn_):
|
||||
salt.utils.print_cli(fn_ + ' is a directory, only files are supported '
|
||||
'in non-chunked mode. Use "--chunked" command '
|
||||
'line argument.')
|
||||
salt.utils.stringutils.print_cli(
|
||||
fn_ + ' is a directory, only files are supported '
|
||||
'in non-chunked mode. Use "--chunked" command '
|
||||
'line argument.')
|
||||
sys.exit(1)
|
||||
return files
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import salt.utils # TODO: Remove this once activate_profile and output_profile are moved
|
||||
import salt.utils.parsers
|
||||
import salt.utils.profile
|
||||
from salt.utils.verify import check_user, verify_log
|
||||
from salt.exceptions import SaltClientError
|
||||
import salt.defaults.exitcodes # pylint: disable=W0611
|
||||
@ -35,7 +35,7 @@ class SaltRun(salt.utils.parsers.SaltRunOptionParser):
|
||||
# someone tries to use the runners via the python API
|
||||
try:
|
||||
if check_user(self.config['user']):
|
||||
pr = salt.utils.activate_profile(profiling_enabled)
|
||||
pr = salt.utils.profile.activate_profile(profiling_enabled)
|
||||
try:
|
||||
ret = runner.run()
|
||||
# In older versions ret['data']['retcode'] was used
|
||||
@ -49,7 +49,7 @@ class SaltRun(salt.utils.parsers.SaltRunOptionParser):
|
||||
elif isinstance(ret, dict) and 'retcode' in ret.get('data', {}):
|
||||
self.exit(ret['data']['retcode'])
|
||||
finally:
|
||||
salt.utils.output_profile(
|
||||
salt.utils.profile.output_profile(
|
||||
pr,
|
||||
stats_path=self.options.profiling_path,
|
||||
stop=True)
|
||||
|
@ -7,8 +7,9 @@ sys.modules['pkg_resources'] = None
|
||||
import os
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils # TODO: Remove this once print_cli is moved
|
||||
import salt.utils.job
|
||||
import salt.utils.parsers
|
||||
import salt.utils.stringutils
|
||||
from salt.utils.args import yamlify_arg
|
||||
from salt.utils.verify import verify_log
|
||||
from salt.exceptions import (
|
||||
@ -93,7 +94,7 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
||||
# potentially switch to batch execution
|
||||
if self.options.batch_safe_limit > 1:
|
||||
if len(self._preview_target()) >= self.options.batch_safe_limit:
|
||||
salt.utils.print_cli('\nNOTICE: Too many minions targeted, switching to batch execution.')
|
||||
salt.utils.stringutils.print_cli('\nNOTICE: Too many minions targeted, switching to batch execution.')
|
||||
self.options.batch = self.options.batch_safe_size
|
||||
self._run_batch()
|
||||
return
|
||||
@ -140,7 +141,7 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
||||
|
||||
if self.config['async']:
|
||||
jid = self.local_client.cmd_async(**kwargs)
|
||||
salt.utils.print_cli('Executed command with job ID: {0}'.format(jid))
|
||||
salt.utils.stringutils.print_cli('Executed command with job ID: {0}'.format(jid))
|
||||
return
|
||||
|
||||
# local will be None when there was an error
|
||||
@ -279,12 +280,12 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
||||
|
||||
def _print_errors_summary(self, errors):
|
||||
if errors:
|
||||
salt.utils.print_cli('\n')
|
||||
salt.utils.print_cli('---------------------------')
|
||||
salt.utils.print_cli('Errors')
|
||||
salt.utils.print_cli('---------------------------')
|
||||
salt.utils.stringutils.print_cli('\n')
|
||||
salt.utils.stringutils.print_cli('---------------------------')
|
||||
salt.utils.stringutils.print_cli('Errors')
|
||||
salt.utils.stringutils.print_cli('---------------------------')
|
||||
for error in errors:
|
||||
salt.utils.print_cli(self._format_error(error))
|
||||
salt.utils.stringutils.print_cli(self._format_error(error))
|
||||
|
||||
def _print_returns_summary(self, ret):
|
||||
'''
|
||||
@ -314,22 +315,22 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
||||
return_counter += 1
|
||||
if self._get_retcode(ret[each_minion]):
|
||||
failed_minions.append(each_minion)
|
||||
salt.utils.print_cli('\n')
|
||||
salt.utils.print_cli('-------------------------------------------')
|
||||
salt.utils.print_cli('Summary')
|
||||
salt.utils.print_cli('-------------------------------------------')
|
||||
salt.utils.print_cli('# of minions targeted: {0}'.format(return_counter + not_return_counter))
|
||||
salt.utils.print_cli('# of minions returned: {0}'.format(return_counter))
|
||||
salt.utils.print_cli('# of minions that did not return: {0}'.format(not_return_counter))
|
||||
salt.utils.print_cli('# of minions with errors: {0}'.format(len(failed_minions)))
|
||||
salt.utils.stringutils.print_cli('\n')
|
||||
salt.utils.stringutils.print_cli('-------------------------------------------')
|
||||
salt.utils.stringutils.print_cli('Summary')
|
||||
salt.utils.stringutils.print_cli('-------------------------------------------')
|
||||
salt.utils.stringutils.print_cli('# of minions targeted: {0}'.format(return_counter + not_return_counter))
|
||||
salt.utils.stringutils.print_cli('# of minions returned: {0}'.format(return_counter))
|
||||
salt.utils.stringutils.print_cli('# of minions that did not return: {0}'.format(not_return_counter))
|
||||
salt.utils.stringutils.print_cli('# of minions with errors: {0}'.format(len(failed_minions)))
|
||||
if self.options.verbose:
|
||||
if not_connected_minions:
|
||||
salt.utils.print_cli('Minions not connected: {0}'.format(" ".join(not_connected_minions)))
|
||||
salt.utils.stringutils.print_cli('Minions not connected: {0}'.format(" ".join(not_connected_minions)))
|
||||
if not_response_minions:
|
||||
salt.utils.print_cli('Minions not responding: {0}'.format(" ".join(not_response_minions)))
|
||||
salt.utils.stringutils.print_cli('Minions not responding: {0}'.format(" ".join(not_response_minions)))
|
||||
if failed_minions:
|
||||
salt.utils.print_cli('Minions with failures: {0}'.format(" ".join(failed_minions)))
|
||||
salt.utils.print_cli('-------------------------------------------')
|
||||
salt.utils.stringutils.print_cli('Minions with failures: {0}'.format(" ".join(failed_minions)))
|
||||
salt.utils.stringutils.print_cli('-------------------------------------------')
|
||||
|
||||
def _progress_end(self, out):
|
||||
import salt.output
|
||||
@ -421,6 +422,6 @@ class SaltCMD(salt.utils.parsers.SaltCMDOptionParser):
|
||||
salt.output.display_output({fun: docs[fun]}, 'nested', self.config)
|
||||
else:
|
||||
for fun in sorted(docs):
|
||||
salt.utils.print_cli('{0}:'.format(fun))
|
||||
salt.utils.print_cli(docs[fun])
|
||||
salt.utils.print_cli('')
|
||||
salt.utils.stringutils.print_cli('{0}:'.format(fun))
|
||||
salt.utils.stringutils.print_cli(docs[fun])
|
||||
salt.utils.stringutils.print_cli('')
|
||||
|
@ -16,7 +16,6 @@ import copy as pycopy
|
||||
# Import Salt libs
|
||||
import salt.exceptions
|
||||
import salt.minion
|
||||
import salt.utils # TODO: Remove this once format_call is moved
|
||||
import salt.utils.args
|
||||
import salt.utils.doc
|
||||
import salt.utils.error
|
||||
@ -371,7 +370,7 @@ class SyncClientMixin(object):
|
||||
args = low[u'arg']
|
||||
kwargs = low[u'kwarg']
|
||||
else:
|
||||
f_call = salt.utils.format_call(
|
||||
f_call = salt.utils.args.format_call(
|
||||
self.functions[fun],
|
||||
low,
|
||||
expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
|
||||
|
@ -36,12 +36,12 @@ import salt.minion
|
||||
import salt.roster
|
||||
import salt.serializers.yaml
|
||||
import salt.state
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.atomicfile
|
||||
import salt.utils.event
|
||||
import salt.utils.files
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.json
|
||||
import salt.utils.network
|
||||
import salt.utils.path
|
||||
import salt.utils.stringutils
|
||||
@ -497,7 +497,7 @@ class SSH(object):
|
||||
**target)
|
||||
stdout, stderr, retcode = single.cmd_block()
|
||||
try:
|
||||
data = salt.utils.find_json(stdout)
|
||||
data = salt.utils.json.find_json(stdout)
|
||||
return {host: data.get(u'local', data)}
|
||||
except Exception:
|
||||
if stderr:
|
||||
@ -525,7 +525,7 @@ class SSH(object):
|
||||
stdout, stderr, retcode = single.run()
|
||||
# This job is done, yield
|
||||
try:
|
||||
data = salt.utils.find_json(stdout)
|
||||
data = salt.utils.json.find_json(stdout)
|
||||
if len(data) < 2 and u'local' in data:
|
||||
ret[u'ret'] = data[u'local']
|
||||
else:
|
||||
|
@ -15,7 +15,6 @@ import subprocess
|
||||
|
||||
# Import salt libs
|
||||
import salt.defaults.exitcodes
|
||||
import salt.utils
|
||||
import salt.utils.nb_popen
|
||||
import salt.utils.vt
|
||||
|
||||
|
@ -29,11 +29,11 @@ from salt.exceptions import (
|
||||
import salt.config
|
||||
import salt.client
|
||||
import salt.loader
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.cloud
|
||||
import salt.utils.context
|
||||
import salt.utils.crypt
|
||||
import salt.utils.data
|
||||
import salt.utils.dictupdate
|
||||
import salt.utils.files
|
||||
import salt.syspaths
|
||||
@ -244,7 +244,7 @@ class CloudClient(object):
|
||||
Pass the cloud function and low data structure to run
|
||||
'''
|
||||
l_fun = getattr(self, fun)
|
||||
f_call = salt.utils.format_call(l_fun, low)
|
||||
f_call = salt.utils.args.format_call(l_fun, low)
|
||||
return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {}))
|
||||
|
||||
def list_sizes(self, provider=None):
|
||||
@ -252,7 +252,7 @@ class CloudClient(object):
|
||||
List all available sizes in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.size_list(provider)
|
||||
)
|
||||
|
||||
@ -261,7 +261,7 @@ class CloudClient(object):
|
||||
List all available images in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.image_list(provider)
|
||||
)
|
||||
|
||||
@ -270,7 +270,7 @@ class CloudClient(object):
|
||||
List all available locations in configured cloud systems
|
||||
'''
|
||||
mapper = salt.cloud.Map(self._opts_defaults())
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.location_list(provider)
|
||||
)
|
||||
|
||||
@ -344,7 +344,7 @@ class CloudClient(object):
|
||||
mapper = salt.cloud.Map(self._opts_defaults(**kwargs))
|
||||
if isinstance(names, six.string_types):
|
||||
names = names.split(',')
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.run_profile(profile, names, vm_overrides=vm_overrides)
|
||||
)
|
||||
|
||||
@ -358,7 +358,7 @@ class CloudClient(object):
|
||||
kwarg.update(kwargs)
|
||||
mapper = salt.cloud.Map(self._opts_defaults(**kwarg))
|
||||
dmap = mapper.map_data()
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.run_map(dmap)
|
||||
)
|
||||
|
||||
@ -369,7 +369,7 @@ class CloudClient(object):
|
||||
mapper = salt.cloud.Map(self._opts_defaults(destroy=True))
|
||||
if isinstance(names, six.string_types):
|
||||
names = names.split(',')
|
||||
return salt.utils.simple_types_filter(
|
||||
return salt.utils.data.simple_types_filter(
|
||||
mapper.destroy(names)
|
||||
)
|
||||
|
||||
@ -408,7 +408,7 @@ class CloudClient(object):
|
||||
vm_['profile'] = None
|
||||
vm_['provider'] = provider
|
||||
|
||||
ret[name] = salt.utils.simple_types_filter(
|
||||
ret[name] = salt.utils.data.simple_types_filter(
|
||||
mapper.create(vm_))
|
||||
return ret
|
||||
|
||||
@ -443,7 +443,7 @@ class CloudClient(object):
|
||||
extra_['provider'] = provider
|
||||
extra_['profile'] = None
|
||||
extra_['action'] = action
|
||||
ret[name] = salt.utils.simple_types_filter(
|
||||
ret[name] = salt.utils.data.simple_types_filter(
|
||||
mapper.extras(extra_)
|
||||
)
|
||||
return ret
|
||||
@ -2324,7 +2324,7 @@ def create_multiprocessing(parallel_data, queue=None):
|
||||
output.pop('deploy_kwargs', None)
|
||||
|
||||
return {
|
||||
parallel_data['name']: salt.utils.simple_types_filter(output)
|
||||
parallel_data['name']: salt.utils.data.simple_types_filter(output)
|
||||
}
|
||||
|
||||
|
||||
@ -2360,7 +2360,7 @@ def destroy_multiprocessing(parallel_data, queue=None):
|
||||
return {parallel_data['name']: {'Error': str(exc)}}
|
||||
|
||||
return {
|
||||
parallel_data['name']: salt.utils.simple_types_filter(output)
|
||||
parallel_data['name']: salt.utils.data.simple_types_filter(output)
|
||||
}
|
||||
|
||||
|
||||
@ -2383,7 +2383,7 @@ def run_parallel_map_providers_query(data, queue=None):
|
||||
return (
|
||||
data['alias'],
|
||||
data['driver'],
|
||||
salt.utils.simple_types_filter(
|
||||
salt.utils.data.simple_types_filter(
|
||||
cloud.clouds[data['fun']]()
|
||||
)
|
||||
)
|
||||
|
@ -63,8 +63,8 @@ import yaml
|
||||
import collections
|
||||
import salt.cache
|
||||
import salt.config as config
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
from salt.utils.versions import LooseVersion
|
||||
from salt.ext import six
|
||||
@ -575,7 +575,7 @@ def show_instance(name, resource_group=None, call=None): # pylint: disable=unus
|
||||
data['resource_group'] = resource_group
|
||||
|
||||
__utils__['cloud.cache_node'](
|
||||
salt.utils.simple_types_filter(data),
|
||||
salt.utils.data.simple_types_filter(data),
|
||||
__active_provider_name__,
|
||||
__opts__
|
||||
)
|
||||
@ -1460,7 +1460,7 @@ def make_safe(data):
|
||||
'''
|
||||
Turn object data into something serializable
|
||||
'''
|
||||
return salt.utils.simple_types_filter(object_to_dict(data))
|
||||
return salt.utils.data.simple_types_filter(object_to_dict(data))
|
||||
|
||||
|
||||
def create_security_group(call=None, kwargs=None): # pylint: disable=unused-argument
|
||||
|
@ -33,7 +33,7 @@ import salt.config as config
|
||||
import salt.utils.cloud
|
||||
import salt.utils.event
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import
|
||||
from salt.utils import namespaced_function
|
||||
from salt.utils.functools import namespaced_function
|
||||
from salt.exceptions import SaltCloudSystemExit
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
|
@ -55,12 +55,9 @@ except ImportError:
|
||||
# Import generic libcloud functions
|
||||
# from salt.cloud.libcloudfuncs import *
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
||||
# Import salt.cloud libs
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import
|
||||
from salt.utils import namespaced_function
|
||||
from salt.utils.functools import namespaced_function
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.exceptions import (
|
||||
|
@ -82,7 +82,7 @@ except ImportError:
|
||||
# pylint: enable=import-error
|
||||
|
||||
# Import salt libs
|
||||
from salt.utils import namespaced_function
|
||||
from salt.utils.functools import namespaced_function
|
||||
from salt.ext import six
|
||||
import salt.utils.cloud
|
||||
import salt.utils.files
|
||||
|
@ -74,7 +74,6 @@ except ImportError:
|
||||
|
||||
# Import salt libs
|
||||
import salt.config as config
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
from salt.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
|
@ -17,9 +17,6 @@ import copy
|
||||
import time
|
||||
from pprint import pformat
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
|
@ -223,7 +223,7 @@ except ImportError as exc:
|
||||
# Import Salt Cloud Libs
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
import salt.config as config
|
||||
from salt.utils import namespaced_function
|
||||
from salt.utils.functools import namespaced_function
|
||||
from salt.exceptions import (
|
||||
SaltCloudConfigError,
|
||||
SaltCloudNotFound,
|
||||
|
@ -185,7 +185,6 @@ except Exception:
|
||||
from salt.cloud.libcloudfuncs import * # pylint: disable=W0614,W0401
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once namespaced_function has been moved
|
||||
import salt.utils.cloud
|
||||
import salt.utils.files
|
||||
import salt.utils.pycrypto
|
||||
@ -197,6 +196,7 @@ from salt.exceptions import (
|
||||
SaltCloudExecutionFailure,
|
||||
SaltCloudExecutionTimeout
|
||||
)
|
||||
from salt.utils.functools import namespaced_function
|
||||
|
||||
# Import netaddr IP matching
|
||||
try:
|
||||
@ -214,19 +214,19 @@ __virtualname__ = 'openstack'
|
||||
# Some of the libcloud functions need to be in the same namespace as the
|
||||
# functions defined in the module, so we create new function objects inside
|
||||
# this module namespace
|
||||
get_size = salt.utils.namespaced_function(get_size, globals())
|
||||
get_image = salt.utils.namespaced_function(get_image, globals())
|
||||
avail_locations = salt.utils.namespaced_function(avail_locations, globals())
|
||||
avail_images = salt.utils.namespaced_function(avail_images, globals())
|
||||
avail_sizes = salt.utils.namespaced_function(avail_sizes, globals())
|
||||
script = salt.utils.namespaced_function(script, globals())
|
||||
destroy = salt.utils.namespaced_function(destroy, globals())
|
||||
reboot = salt.utils.namespaced_function(reboot, globals())
|
||||
list_nodes = salt.utils.namespaced_function(list_nodes, globals())
|
||||
list_nodes_full = salt.utils.namespaced_function(list_nodes_full, globals())
|
||||
list_nodes_select = salt.utils.namespaced_function(list_nodes_select, globals())
|
||||
show_instance = salt.utils.namespaced_function(show_instance, globals())
|
||||
get_node = salt.utils.namespaced_function(get_node, globals())
|
||||
get_size = namespaced_function(get_size, globals())
|
||||
get_image = namespaced_function(get_image, globals())
|
||||
avail_locations = namespaced_function(avail_locations, globals())
|
||||
avail_images = namespaced_function(avail_images, globals())
|
||||
avail_sizes = namespaced_function(avail_sizes, globals())
|
||||
script = namespaced_function(script, globals())
|
||||
destroy = namespaced_function(destroy, globals())
|
||||
reboot = namespaced_function(reboot, globals())
|
||||
list_nodes = namespaced_function(list_nodes, globals())
|
||||
list_nodes_full = namespaced_function(list_nodes_full, globals())
|
||||
list_nodes_select = namespaced_function(list_nodes_select, globals())
|
||||
show_instance = namespaced_function(show_instance, globals())
|
||||
get_node = namespaced_function(get_node, globals())
|
||||
|
||||
|
||||
# Only load in this module is the OPENSTACK configurations are in place
|
||||
|
@ -75,7 +75,7 @@ from salt.exceptions import (
|
||||
import salt.utils.cloud
|
||||
|
||||
from salt.cloud.libcloudfuncs import get_size, get_image, script, show_instance
|
||||
from salt.utils import namespaced_function
|
||||
from salt.utils.functools import namespaced_function
|
||||
|
||||
get_size = namespaced_function(get_size, globals())
|
||||
get_image = namespaced_function(get_image, globals())
|
||||
|
@ -27,7 +27,6 @@ import pprint
|
||||
import logging
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
from salt._compat import ElementTree as ET
|
||||
# pylint: disable=import-error,no-name-in-module
|
||||
from salt.ext.six.moves.urllib.error import URLError
|
||||
|
@ -39,7 +39,6 @@ from salt.ext import six
|
||||
import salt.utils
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
from salt.exceptions import (
|
||||
SaltCloudSystemExit,
|
||||
|
@ -13,7 +13,7 @@ module instead.
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
import salt.config as config
|
||||
|
||||
# Import pyrax libraries
|
||||
@ -84,13 +84,13 @@ def queues_exists(call, kwargs):
|
||||
|
||||
def queues_show(call, kwargs):
|
||||
conn = get_conn('RackspaceQueues')
|
||||
return salt.utils.simple_types_filter(conn.show(kwargs['name']).__dict__)
|
||||
return salt.utils.data.simple_types_filter(conn.show(kwargs['name']).__dict__)
|
||||
|
||||
|
||||
def queues_create(call, kwargs):
|
||||
conn = get_conn('RackspaceQueues')
|
||||
if conn.create(kwargs['name']):
|
||||
return salt.utils.simple_types_filter(conn.show(kwargs['name']).__dict__)
|
||||
return salt.utils.data.simple_types_filter(conn.show(kwargs['name']).__dict__)
|
||||
else:
|
||||
return {}
|
||||
|
||||
@ -100,4 +100,4 @@ def queues_delete(call, kwargs):
|
||||
if conn.delete(kwargs['name']):
|
||||
return {}
|
||||
else:
|
||||
return salt.utils.simple_types_filter(conn.show(kwargs['name'].__dict__))
|
||||
return salt.utils.data.simple_types_filter(conn.show(kwargs['name'].__dict__))
|
||||
|
@ -17,7 +17,7 @@ from __future__ import absolute_import
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
import salt.config as config
|
||||
import salt.netapi
|
||||
import salt.ext.six as six
|
||||
|
@ -124,7 +124,6 @@ import os.path
|
||||
import subprocess
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
import salt.utils.network
|
||||
import salt.utils.stringutils
|
||||
|
@ -40,8 +40,8 @@ import salt.utils.event
|
||||
import salt.client
|
||||
|
||||
# Import salt cloud libs
|
||||
import salt.utils
|
||||
import salt.utils.cloud
|
||||
import salt.utils.data
|
||||
import salt.config as config
|
||||
from salt.exceptions import SaltCloudNotFound, SaltCloudSystemExit
|
||||
|
||||
@ -123,7 +123,7 @@ def get_node(conn, name):
|
||||
nodes = conn.list_nodes()
|
||||
for node in nodes:
|
||||
if node.name == name:
|
||||
__utils__['cloud.cache_node'](salt.utils.simple_types_filter(node.__dict__), __active_provider_name__, __opts__)
|
||||
__utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__)
|
||||
return node
|
||||
|
||||
|
||||
|
@ -19,7 +19,6 @@ import json
|
||||
# Import salt libs
|
||||
from salt.ext import six
|
||||
import salt.daemons.masterapi
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
|
@ -15,7 +15,6 @@ import stat
|
||||
|
||||
# Import salt libs
|
||||
import salt.crypt
|
||||
import salt.utils # TODO: Remove this once check_whitelist_blacklist, expr_match, get_values_of_matching_keys are moved
|
||||
import salt.cache
|
||||
import salt.client
|
||||
import salt.payload
|
||||
@ -39,6 +38,7 @@ import salt.utils.gzip_util
|
||||
import salt.utils.jid
|
||||
import salt.utils.minions
|
||||
import salt.utils.platform
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.user
|
||||
import salt.utils.verify
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
@ -241,7 +241,7 @@ def access_keys(opts):
|
||||
log.profile('Beginning pwd.getpwall() call in masterapi access_keys function')
|
||||
for user in pwd.getpwall():
|
||||
user = user.pw_name
|
||||
if user not in keys and salt.utils.check_whitelist_blacklist(user, whitelist=acl_users):
|
||||
if user not in keys and salt.utils.stringutils.check_whitelist_blacklist(user, whitelist=acl_users):
|
||||
keys[user] = mk_key(opts, user)
|
||||
log.profile('End pwd.getpwall() call in masterapi access_keys function')
|
||||
|
||||
@ -342,7 +342,7 @@ class AutoKey(object):
|
||||
if line.startswith('#'):
|
||||
continue
|
||||
else:
|
||||
if salt.utils.expr_match(keyid, line):
|
||||
if salt.utils.stringutils.expr_match(keyid, line):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -1235,7 +1235,9 @@ class LocalFuncs(object):
|
||||
auth_ret = True
|
||||
|
||||
if auth_ret is not True:
|
||||
auth_list = salt.utils.get_values_of_matching_keys(
|
||||
# Avoid circular import
|
||||
import salt.utils.master
|
||||
auth_list = salt.utils.master.get_values_of_matching_keys(
|
||||
self.opts['publisher_acl'],
|
||||
auth_ret)
|
||||
if not auth_list:
|
||||
|
@ -11,7 +11,7 @@ import json
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
import salt.utils
|
||||
import salt.utils.event
|
||||
|
||||
# pylint: disable=import-error
|
||||
try:
|
||||
|
@ -189,9 +189,9 @@ except ImportError:
|
||||
HAS_NAPALM_LOGS = False
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.event as event
|
||||
import salt.utils.network
|
||||
import salt.utils.stringutils
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
# module properties
|
||||
@ -337,25 +337,28 @@ def start(transport='zmq',
|
||||
try:
|
||||
event_os = dict_object['os']
|
||||
if os_blacklist or os_whitelist:
|
||||
valid_os = salt.utils.check_whitelist_blacklist(event_os,
|
||||
whitelist=os_whitelist,
|
||||
blacklist=os_blacklist)
|
||||
valid_os = salt.utils.stringutils.check_whitelist_blacklist(
|
||||
event_os,
|
||||
whitelist=os_whitelist,
|
||||
blacklist=os_blacklist)
|
||||
if not valid_os:
|
||||
log.info('Ignoring NOS {} as per whitelist/blacklist'.format(event_os))
|
||||
continue
|
||||
event_error = dict_object['error']
|
||||
if error_blacklist or error_whitelist:
|
||||
valid_error = salt.utils.check_whitelist_blacklist(event_error,
|
||||
whitelist=error_whitelist,
|
||||
blacklist=error_blacklist)
|
||||
valid_error = salt.utils.stringutils.check_whitelist_blacklist(
|
||||
event_error,
|
||||
whitelist=error_whitelist,
|
||||
blacklist=error_blacklist)
|
||||
if not valid_error:
|
||||
log.info('Ignoring error {} as per whitelist/blacklist'.format(event_error))
|
||||
continue
|
||||
event_host = dict_object.get('host') or dict_object.get('ip')
|
||||
if host_blacklist or host_whitelist:
|
||||
valid_host = salt.utils.check_whitelist_blacklist(event_host,
|
||||
whitelist=host_whitelist,
|
||||
blacklist=host_blacklist)
|
||||
valid_host = salt.utils.stringutils.check_whitelist_blacklist(
|
||||
event_host,
|
||||
whitelist=host_whitelist,
|
||||
blacklist=host_blacklist)
|
||||
if not valid_host:
|
||||
log.info('Ignoring messages from {} as per whitelist/blacklist'.format(event_host))
|
||||
continue
|
||||
|
@ -115,7 +115,6 @@ import salt.client
|
||||
import salt.loader
|
||||
import salt.minion
|
||||
import salt.runner
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.event
|
||||
import salt.utils.http
|
||||
|
@ -235,9 +235,10 @@ class SaltRenderError(SaltException):
|
||||
if trace:
|
||||
exc_str += u'\n{0}\n'.format(trace)
|
||||
if self.line_num and self.buffer:
|
||||
import salt.utils
|
||||
# Avoid circular import
|
||||
import salt.utils.stringutils
|
||||
self.context = salt.utils.get_context(
|
||||
import salt.utils.templates
|
||||
self.context = salt.utils.templates.get_context(
|
||||
self.buffer,
|
||||
self.line_num,
|
||||
marker=marker
|
||||
|
@ -24,7 +24,6 @@ import salt.loader
|
||||
import salt.payload
|
||||
import salt.transport
|
||||
import salt.fileserver
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
@ -240,7 +239,7 @@ class Client(object):
|
||||
for fn_ in self.file_list(saltenv):
|
||||
fn_ = sdecode(fn_)
|
||||
if fn_.strip() and fn_.startswith(path):
|
||||
if salt.utils.check_include_exclude(
|
||||
if salt.utils.stringutils.check_include_exclude(
|
||||
fn_, include_pat, exclude_pat):
|
||||
fn_ = self.cache_file(
|
||||
salt.utils.url.create(fn_), saltenv, cachedir=cachedir)
|
||||
@ -490,7 +489,7 @@ class Client(object):
|
||||
strpath = u'index.html'
|
||||
|
||||
if salt.utils.platform.is_windows():
|
||||
strpath = salt.utils.sanitize_win_path_string(strpath)
|
||||
strpath = salt.utils.path.sanitize_win_path(strpath)
|
||||
|
||||
dest = os.path.join(dest, strpath)
|
||||
|
||||
@ -805,7 +804,7 @@ class Client(object):
|
||||
'''
|
||||
url_data = urlparse(url)
|
||||
if salt.utils.platform.is_windows():
|
||||
netloc = salt.utils.sanitize_win_path_string(url_data.netloc)
|
||||
netloc = salt.utils.path.sanitize_win_path(url_data.netloc)
|
||||
else:
|
||||
netloc = url_data.netloc
|
||||
|
||||
|
@ -55,7 +55,6 @@ import shutil
|
||||
|
||||
# Import salt libs
|
||||
import salt.fileserver
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
|
@ -59,11 +59,11 @@ except ImportError:
|
||||
# pylint: enable=import-error
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.url
|
||||
import salt.utils.versions
|
||||
import salt.fileserver
|
||||
@ -591,7 +591,7 @@ def _env_is_exposed(env):
|
||||
else:
|
||||
blacklist = __opts__['hgfs_saltenv_blacklist']
|
||||
|
||||
return salt.utils.check_whitelist_blacklist(
|
||||
return salt.utils.stringutils.check_whitelist_blacklist(
|
||||
env,
|
||||
whitelist=whitelist,
|
||||
blacklist=blacklist,
|
||||
|
@ -31,10 +31,10 @@ import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.fileserver
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.url
|
||||
import salt.utils.versions
|
||||
|
||||
@ -61,7 +61,7 @@ def _is_exposed(minion):
|
||||
'''
|
||||
Check if the minion is exposed, based on the whitelist and blacklist
|
||||
'''
|
||||
return salt.utils.check_whitelist_blacklist(
|
||||
return salt.utils.stringutils.check_whitelist_blacklist(
|
||||
minion,
|
||||
whitelist=__opts__['minionfs_whitelist'],
|
||||
blacklist=__opts__['minionfs_blacklist']
|
||||
|
@ -29,6 +29,7 @@ import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.versions
|
||||
from salt.ext import six
|
||||
|
||||
@ -351,7 +352,7 @@ def _file_lists(load, form):
|
||||
'roots: %s symlink destination is %s',
|
||||
abs_path, link_dest
|
||||
)
|
||||
if salt.utils.is_windows() \
|
||||
if salt.utils.platform.is_windows() \
|
||||
and link_dest.startswith('\\\\'):
|
||||
# Symlink points to a network path. Since you can't
|
||||
# join UNC and non-UNC paths, just assume the original
|
||||
|
@ -68,7 +68,6 @@ import logging
|
||||
# Import salt libs
|
||||
import salt.fileserver as fs
|
||||
import salt.modules
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
|
@ -54,11 +54,11 @@ except ImportError:
|
||||
# pylint: enable=import-error
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.url
|
||||
import salt.utils.versions
|
||||
import salt.fileserver
|
||||
@ -506,7 +506,7 @@ def _env_is_exposed(env):
|
||||
else:
|
||||
blacklist = __opts__['svnfs_saltenv_blacklist']
|
||||
|
||||
return salt.utils.check_whitelist_blacklist(
|
||||
return salt.utils.stringutils.check_whitelist_blacklist(
|
||||
env,
|
||||
whitelist=whitelist,
|
||||
blacklist=blacklist,
|
||||
|
@ -43,7 +43,6 @@ except ImportError:
|
||||
# Import salt libs
|
||||
import salt.exceptions
|
||||
import salt.log
|
||||
import salt.utils
|
||||
import salt.utils.dns
|
||||
import salt.utils.files
|
||||
import salt.utils.network
|
||||
|
@ -22,13 +22,13 @@ import salt.crypt
|
||||
import salt.daemons.masterapi
|
||||
import salt.exceptions
|
||||
import salt.minion
|
||||
import salt.utils # TODO: Remove this once get_master_key is moved
|
||||
import salt.utils.args
|
||||
import salt.utils.crypt
|
||||
import salt.utils.data
|
||||
import salt.utils.event
|
||||
import salt.utils.files
|
||||
import salt.utils.kinds
|
||||
import salt.utils.master
|
||||
import salt.utils.sdb
|
||||
import salt.utils.user
|
||||
|
||||
@ -149,7 +149,7 @@ class KeyCLI(object):
|
||||
low[u'eauth'] = self.opts[u'eauth']
|
||||
else:
|
||||
low[u'user'] = salt.utils.user.get_specific_user()
|
||||
low[u'key'] = salt.utils.get_master_key(low[u'user'], self.opts, skip_perm_errors)
|
||||
low[u'key'] = salt.utils.master.get_master_key(low[u'user'], self.opts, skip_perm_errors)
|
||||
|
||||
self.auth = low
|
||||
|
||||
|
@ -47,7 +47,6 @@ import tornado.gen # pylint: disable=F0401
|
||||
|
||||
# Import salt libs
|
||||
import salt.crypt
|
||||
import salt.utils # TODO: Remove this once get_values_of_matching_keys is moved
|
||||
import salt.client
|
||||
import salt.payload
|
||||
import salt.pillar
|
||||
@ -1440,7 +1439,7 @@ class AESFuncs(object):
|
||||
path_name = os.path.split(syndic_cache_path)[0]
|
||||
if not os.path.exists(path_name):
|
||||
os.makedirs(path_name)
|
||||
with salt.utils.fopen(syndic_cache_path, u'w') as wfh:
|
||||
with salt.utils.files.fopen(syndic_cache_path, u'w') as wfh:
|
||||
wfh.write(u'')
|
||||
|
||||
# Format individual return loads
|
||||
@ -1903,7 +1902,7 @@ class ClearFuncs(object):
|
||||
auth_ret = True
|
||||
|
||||
if auth_ret is not True:
|
||||
auth_list = salt.utils.get_values_of_matching_keys(
|
||||
auth_list = salt.utils.master.get_values_of_matching_keys(
|
||||
self.opts[u'publisher_acl'],
|
||||
auth_ret)
|
||||
if not auth_list:
|
||||
|
@ -74,6 +74,12 @@ try:
|
||||
HAS_ZMQ_MONITOR = True
|
||||
except ImportError:
|
||||
HAS_ZMQ_MONITOR = False
|
||||
|
||||
try:
|
||||
import salt.utils.win_functions
|
||||
HAS_WIN_FUNCTIONS = True
|
||||
except ImportError:
|
||||
HAS_WIN_FUNCTIONS = False
|
||||
# pylint: enable=import-error
|
||||
|
||||
# Import salt libs
|
||||
@ -86,7 +92,6 @@ import salt.engines
|
||||
import salt.payload
|
||||
import salt.pillar
|
||||
import salt.syspaths
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.context
|
||||
import salt.utils.data
|
||||
@ -2371,7 +2376,8 @@ class Minion(MinionBase):
|
||||
enable_sigusr1_handler()
|
||||
|
||||
# Make sure to gracefully handle CTRL_LOGOFF_EVENT
|
||||
salt.utils.enable_ctrl_logoff_handler()
|
||||
if HAS_WIN_FUNCTIONS:
|
||||
salt.utils.win_functions.enable_ctrl_logoff_handler()
|
||||
|
||||
# On first startup execute a state run if configured to do so
|
||||
self._state_run()
|
||||
|
@ -8,7 +8,6 @@ from __future__ import absolute_import
|
||||
import logging
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
import salt.utils.decorators as decorators
|
||||
|
||||
|
@ -38,10 +38,10 @@ from salt.ext.six.moves.urllib.request import Request as _Request, urlopen as _u
|
||||
import salt.config
|
||||
import salt.syspaths
|
||||
from salt.modules.cmdmod import _parse_env
|
||||
import salt.utils # TODO: Remove this when alias_function is moved
|
||||
import salt.utils.args
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.itertools
|
||||
import salt.utils.path
|
||||
import salt.utils.pkg
|
||||
@ -319,7 +319,7 @@ def latest_version(*names, **kwargs):
|
||||
return ret
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def version(*names, **kwargs):
|
||||
|
@ -10,7 +10,7 @@ import base64
|
||||
import logging
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.ext.six.moves.http_client # pylint: disable=import-error,redefined-builtin,no-name-in-module
|
||||
from salt.ext.six.moves import urllib # pylint: disable=no-name-in-module
|
||||
from salt.ext.six.moves.urllib.error import HTTPError, URLError # pylint: disable=no-name-in-module
|
||||
|
@ -41,7 +41,6 @@ except ImportError:
|
||||
pass
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
from salt.exceptions import SaltInvocationError
|
||||
|
||||
|
@ -9,7 +9,6 @@ import logging
|
||||
import json
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
from salt.ext import six
|
||||
|
||||
|
@ -22,8 +22,6 @@ except ImportError:
|
||||
from salt.ext import six
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.output
|
||||
import salt.exceptions
|
||||
|
||||
# Setup the logger
|
||||
|
@ -57,7 +57,6 @@ import logging
|
||||
from salt.ext import six
|
||||
import salt.utils.boto3
|
||||
import salt.utils.compat
|
||||
import salt.utils
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -83,7 +83,6 @@ import logging
|
||||
# Import Salt libs
|
||||
import salt.utils.boto3
|
||||
import salt.utils.compat
|
||||
import salt.utils
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -83,7 +83,6 @@ import json
|
||||
from salt.ext import six
|
||||
import salt.utils.boto3
|
||||
import salt.utils.compat
|
||||
import salt.utils
|
||||
from salt.exceptions import SaltInvocationError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
|
@ -58,7 +58,6 @@ import datetime
|
||||
# Import Salt libs
|
||||
import salt.utils.boto3
|
||||
import salt.utils.compat
|
||||
import salt.utils
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -56,7 +56,6 @@ import time
|
||||
import salt.utils.boto3
|
||||
import salt.utils.compat
|
||||
import salt.utils.odict as odict
|
||||
import salt.utils
|
||||
from salt.exceptions import SaltInvocationError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
|
@ -60,7 +60,6 @@ import json
|
||||
from salt.ext import six
|
||||
from salt.ext.six.moves import range # pylint: disable=import-error
|
||||
import salt.utils.compat
|
||||
import salt.utils
|
||||
from salt.exceptions import SaltInvocationError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
|
@ -8,7 +8,7 @@ from __future__ import absolute_import
|
||||
import os
|
||||
import logging
|
||||
import copy
|
||||
import salt.utils
|
||||
import salt.utils.data
|
||||
|
||||
# Import salt libs
|
||||
try:
|
||||
@ -17,7 +17,6 @@ try:
|
||||
except ImportError:
|
||||
HAS_SALTCLOUD = False
|
||||
|
||||
import salt.utils
|
||||
from salt.exceptions import SaltCloudConfigError
|
||||
|
||||
# Import 3rd-party libs
|
||||
@ -175,7 +174,7 @@ def get_instance(name, provider=None):
|
||||
|
||||
'''
|
||||
data = action(fun='show_instance', names=[name], provider=provider)
|
||||
info = salt.utils.simple_types_filter(data)
|
||||
info = salt.utils.data.simple_types_filter(data)
|
||||
try:
|
||||
# get the first: [alias][driver][vm_name]
|
||||
info = next(six.itervalues(next(six.itervalues(next(six.itervalues(info))))))
|
||||
|
@ -14,7 +14,6 @@ import fnmatch
|
||||
# Import salt libs
|
||||
import salt.minion
|
||||
import salt.fileclient
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.gzip_util
|
||||
import salt.utils.locales
|
||||
|
@ -14,8 +14,8 @@ import os
|
||||
import random
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.stringutils
|
||||
from salt.ext.six.moves import range
|
||||
@ -366,7 +366,7 @@ def list_tab(user):
|
||||
return ret
|
||||
|
||||
# For consistency's sake
|
||||
ls = salt.utils.alias_function(list_tab, 'ls')
|
||||
ls = salt.utils.functools.alias_function(list_tab, 'ls')
|
||||
|
||||
|
||||
def set_special(user, special, cmd):
|
||||
@ -612,7 +612,7 @@ def rm_job(user,
|
||||
return comdat['stderr']
|
||||
return ret
|
||||
|
||||
rm = salt.utils.alias_function(rm_job, 'rm')
|
||||
rm = salt.utils.functools.alias_function(rm_job, 'rm')
|
||||
|
||||
|
||||
def set_env(user, name, value=None):
|
||||
|
@ -10,7 +10,6 @@ import os
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
import salt.utils.files
|
||||
import salt.utils.versions
|
||||
|
@ -201,12 +201,13 @@ import subprocess
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
from salt.ext import six
|
||||
from salt.ext.six.moves import map # pylint: disable=import-error,redefined-builtin
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.decorators
|
||||
import salt.utils.docker
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.json
|
||||
import salt.utils.path
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.thin
|
||||
@ -2745,7 +2746,7 @@ def copy_from(name, source, dest, overwrite=False, makedirs=False):
|
||||
|
||||
|
||||
# Docker cp gets a file from the container, alias this to copy_from
|
||||
cp = salt.utils.alias_function(copy_from, 'cp')
|
||||
cp = salt.utils.functools.alias_function(copy_from, 'cp')
|
||||
|
||||
|
||||
@_ensure_exists
|
||||
@ -4393,7 +4394,7 @@ def pause(name):
|
||||
.format(name))}
|
||||
return _change_state(name, 'pause', 'paused')
|
||||
|
||||
freeze = salt.utils.alias_function(pause, 'freeze')
|
||||
freeze = salt.utils.functools.alias_function(pause, 'freeze')
|
||||
|
||||
|
||||
@_ensure_exists
|
||||
@ -4600,7 +4601,7 @@ def unpause(name):
|
||||
.format(name))}
|
||||
return _change_state(name, 'unpause', 'running')
|
||||
|
||||
unfreeze = salt.utils.alias_function(unpause, 'unfreeze')
|
||||
unfreeze = salt.utils.functools.alias_function(unpause, 'unfreeze')
|
||||
|
||||
|
||||
def wait(name, ignore_already_stopped=False, fail_on_exit_status=False):
|
||||
@ -5370,7 +5371,7 @@ def call(name, function, *args, **kwargs):
|
||||
|
||||
# process "real" result in stdout
|
||||
try:
|
||||
data = salt.utils.find_json(ret['stdout'])
|
||||
data = salt.utils.json.find_json(ret['stdout'])
|
||||
local = data.get('local', data)
|
||||
if isinstance(local, dict):
|
||||
if 'retcode' in local:
|
||||
|
@ -21,9 +21,9 @@ import logging
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once alias_function is moved
|
||||
import salt.utils.args
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.pkg
|
||||
import salt.utils.systemd
|
||||
@ -261,7 +261,7 @@ def latest_version(*names, **kwargs):
|
||||
return ret
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def _get_upgradable(backtrack=3):
|
||||
|
@ -46,12 +46,12 @@ except ImportError:
|
||||
pass
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.atomicfile
|
||||
import salt.utils.filebuffer
|
||||
import salt.utils.files
|
||||
import salt.utils.find
|
||||
import salt.utils.functools
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.itertools
|
||||
import salt.utils.locales
|
||||
@ -2320,14 +2320,14 @@ def replace(path,
|
||||
if not_found_content is None:
|
||||
not_found_content = repl
|
||||
if prepend_if_not_found:
|
||||
new_file.insert(0, not_found_content + salt.utils.to_bytes(os.linesep))
|
||||
new_file.insert(0, not_found_content + salt.utils.stringutils.to_bytes(os.linesep))
|
||||
else:
|
||||
# append_if_not_found
|
||||
# Make sure we have a newline at the end of the file
|
||||
if 0 != len(new_file):
|
||||
if not new_file[-1].endswith(salt.utils.to_bytes(os.linesep)):
|
||||
new_file[-1] += salt.utils.to_bytes(os.linesep)
|
||||
new_file.append(not_found_content + salt.utils.to_bytes(os.linesep))
|
||||
if not new_file[-1].endswith(salt.utils.stringutils.to_bytes(os.linesep)):
|
||||
new_file[-1] += salt.utils.stringutils.to_bytes(os.linesep)
|
||||
new_file.append(not_found_content + salt.utils.stringutils.to_bytes(os.linesep))
|
||||
has_changes = True
|
||||
if not dry_run:
|
||||
try:
|
||||
@ -2513,7 +2513,7 @@ def blockreplace(path,
|
||||
bufsize=1, mode='rb')
|
||||
for line in fi_file:
|
||||
|
||||
line = salt.utils.to_str(line)
|
||||
line = salt.utils.stringutils.to_str(line)
|
||||
result = line
|
||||
|
||||
if marker_start in line:
|
||||
@ -2622,7 +2622,7 @@ def blockreplace(path,
|
||||
try:
|
||||
fh_ = salt.utils.atomicfile.atomic_open(path, 'wb')
|
||||
for line in new_file:
|
||||
fh_.write(salt.utils.to_bytes(line))
|
||||
fh_.write(salt.utils.stringutils.to_bytes(line))
|
||||
finally:
|
||||
fh_.close()
|
||||
|
||||
@ -3763,7 +3763,7 @@ def source_list(source, source_hash, saltenv):
|
||||
single_hash = single[single_src] if single[single_src] else source_hash
|
||||
urlparsed_single_src = _urlparse(single_src)
|
||||
# Fix this for Windows
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
# urlparse doesn't handle a local Windows path without the
|
||||
# protocol indicator (file://). The scheme will be the
|
||||
# drive letter instead of the protocol. So, we'll add the
|
||||
@ -3800,7 +3800,7 @@ def source_list(source, source_hash, saltenv):
|
||||
ret = (single, source_hash)
|
||||
break
|
||||
urlparsed_src = _urlparse(single)
|
||||
if salt.utils.is_windows():
|
||||
if salt.utils.platform.is_windows():
|
||||
# urlparse doesn't handle a local Windows path without the
|
||||
# protocol indicator (file://). The scheme will be the
|
||||
# drive letter instead of the protocol. So, we'll add the
|
||||
@ -5868,7 +5868,7 @@ def list_backups(path, limit=None):
|
||||
[files[x] for x in sorted(files, reverse=True)[:limit]]
|
||||
)))
|
||||
|
||||
list_backup = salt.utils.alias_function(list_backups, 'list_backup')
|
||||
list_backup = salt.utils.functools.alias_function(list_backups, 'list_backup')
|
||||
|
||||
|
||||
def list_backups_dir(path, limit=None):
|
||||
@ -5969,7 +5969,7 @@ def restore_backup(path, backup_id):
|
||||
'{1}'.format(backup_id, path)
|
||||
return ret
|
||||
|
||||
salt.utils.backup_minion(path, _get_bkroot())
|
||||
salt.utils.files.backup_minion(path, _get_bkroot())
|
||||
try:
|
||||
shutil.copyfile(backup['Location'], path)
|
||||
except IOError as exc:
|
||||
@ -6040,7 +6040,7 @@ def delete_backup(path, backup_id):
|
||||
|
||||
return ret
|
||||
|
||||
remove_backup = salt.utils.alias_function(delete_backup, 'remove_backup')
|
||||
remove_backup = salt.utils.functools.alias_function(delete_backup, 'remove_backup')
|
||||
|
||||
|
||||
def grep(path,
|
||||
|
@ -80,8 +80,8 @@ import logging
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this when alias_function is moved
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.pkg
|
||||
from salt.exceptions import CommandExecutionError, MinionError
|
||||
from salt.ext import six
|
||||
@ -200,7 +200,7 @@ def latest_version(*names, **kwargs):
|
||||
return '' if len(names) == 1 else dict((x, '') for x in names)
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def version(*names, **kwargs):
|
||||
@ -486,9 +486,9 @@ def remove(name=None, pkgs=None, **kwargs):
|
||||
return ret
|
||||
|
||||
# Support pkg.delete to remove packages to more closely match pkg_delete
|
||||
delete = salt.utils.alias_function(remove, 'delete')
|
||||
delete = salt.utils.functools.alias_function(remove, 'delete')
|
||||
# No equivalent to purge packages, use remove instead
|
||||
purge = salt.utils.alias_function(remove, 'purge')
|
||||
purge = salt.utils.functools.alias_function(remove, 'purge')
|
||||
|
||||
|
||||
def _rehash():
|
||||
|
@ -12,12 +12,13 @@ import re
|
||||
import stat
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.itertools
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.templates
|
||||
import salt.utils.url
|
||||
from salt.exceptions import SaltInvocationError, CommandExecutionError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
@ -209,7 +210,7 @@ def _git_run(command, cwd=None, user=None, password=None, identity=None,
|
||||
for id_file in identity:
|
||||
if 'salt://' in id_file:
|
||||
with salt.utils.files.set_umask(0o077):
|
||||
tmp_identity_file = salt.utils.mkstemp()
|
||||
tmp_identity_file = salt.utils.files.mkstemp()
|
||||
_id_file = id_file
|
||||
id_file = __salt__['cp.get_file'](id_file,
|
||||
tmp_identity_file,
|
||||
@ -1242,7 +1243,7 @@ def config_get_regexp(key,
|
||||
ret.setdefault(param, []).append(value)
|
||||
return ret
|
||||
|
||||
config_get_regex = salt.utils.alias_function(config_get_regexp, 'config_get_regex')
|
||||
config_get_regex = salt.utils.functools.alias_function(config_get_regexp, 'config_get_regex')
|
||||
|
||||
|
||||
def config_set(key,
|
||||
|
@ -12,7 +12,6 @@ import hmac
|
||||
# Import Salt libs
|
||||
import salt.exceptions
|
||||
from salt.ext import six
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.stringutils
|
||||
|
@ -9,8 +9,8 @@ import logging
|
||||
import os
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
from salt.ext.six.moves import range
|
||||
|
||||
# Set up logging
|
||||
@ -211,7 +211,7 @@ def list_tab(user):
|
||||
return ret
|
||||
|
||||
# For consistency's sake
|
||||
ls = salt.utils.alias_function(list_tab, 'ls')
|
||||
ls = salt.utils.functools.alias_function(list_tab, 'ls')
|
||||
|
||||
|
||||
def set_job(user, path, mask, cmd):
|
||||
@ -315,4 +315,4 @@ def rm_job(user,
|
||||
|
||||
return ret
|
||||
|
||||
rm = salt.utils.alias_function(rm_job, 'rm')
|
||||
rm = salt.utils.functools.alias_function(rm_job, 'rm')
|
||||
|
@ -12,6 +12,7 @@ try:
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
from salt.exceptions import CommandExecutionError
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.systemd
|
||||
import salt.modules.yumpkg
|
||||
__IMPORT_ERROR = None
|
||||
@ -24,7 +25,7 @@ log = logging.getLogger(__name__)
|
||||
__virtualname__ = 'kernelpkg'
|
||||
|
||||
# Import functions from yumpkg
|
||||
_yum = salt.utils.namespaced_function(salt.modules.yumpkg._yum, globals()) # pylint: disable=invalid-name, protected-access
|
||||
_yum = salt.utils.functools.namespaced_function(salt.modules.yumpkg._yum, globals()) # pylint: disable=invalid-name, protected-access
|
||||
|
||||
|
||||
def __virtual__():
|
||||
|
@ -177,11 +177,11 @@ def _cleanup(**kwargs):
|
||||
cert = kubernetes.client.configuration.cert_file
|
||||
key = kubernetes.client.configuration.key_file
|
||||
if cert and os.path.exists(cert) and os.path.basename(cert).startswith('salt-kube-'):
|
||||
salt.utils.safe_rm(cert)
|
||||
salt.utils.files.safe_rm(cert)
|
||||
if key and os.path.exists(key) and os.path.basename(key).startswith('salt-kube-'):
|
||||
salt.utils.safe_rm(key)
|
||||
salt.utils.files.safe_rm(key)
|
||||
if ca and os.path.exists(ca) and os.path.basename(ca).startswith('salt-kube-'):
|
||||
salt.utils.safe_rm(ca)
|
||||
salt.utils.files.safe_rm(ca)
|
||||
|
||||
|
||||
def ping(**kwargs):
|
||||
|
@ -20,11 +20,10 @@ import fnmatch
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.decorators as decorators
|
||||
import salt.utils.files
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
from salt.ext import six
|
||||
|
||||
|
@ -13,7 +13,6 @@ except ImportError:
|
||||
from pipes import quote as _quote_args
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.decorators as decorators
|
||||
import salt.utils.files
|
||||
|
@ -25,11 +25,11 @@ import re
|
||||
import random
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.cloud
|
||||
import salt.utils.dictupdate
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.network
|
||||
import salt.utils.odict
|
||||
@ -2598,7 +2598,7 @@ def destroy(name, stop=False, path=None):
|
||||
return _change_state('lxc-destroy', name, None, path=path)
|
||||
|
||||
# Compatibility between LXC and nspawn
|
||||
remove = salt.utils.alias_function(destroy, 'remove')
|
||||
remove = salt.utils.functools.alias_function(destroy, 'remove')
|
||||
|
||||
|
||||
def exists(name, path=None):
|
||||
@ -2941,7 +2941,7 @@ def set_password(name, users, password, encrypted=True, path=None):
|
||||
)
|
||||
return True
|
||||
|
||||
set_pass = salt.utils.alias_function(set_password, 'set_pass')
|
||||
set_pass = salt.utils.functools.alias_function(set_password, 'set_pass')
|
||||
|
||||
|
||||
def update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None):
|
||||
@ -4206,7 +4206,7 @@ def copy_to(name, source, dest, overwrite=False, makedirs=False, path=None):
|
||||
overwrite=overwrite,
|
||||
makedirs=makedirs)
|
||||
|
||||
cp = salt.utils.alias_function(copy_to, 'cp')
|
||||
cp = salt.utils.functools.alias_function(copy_to, 'cp')
|
||||
|
||||
|
||||
def read_conf(conf_file, out_format='simple'):
|
||||
|
@ -17,8 +17,8 @@ import json
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this when alias_function is moved
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.pkg
|
||||
import salt.utils.versions
|
||||
@ -190,7 +190,7 @@ def latest_version(*names, **kwargs):
|
||||
return versions_dict
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def remove(name=None, pkgs=None, **kwargs):
|
||||
|
@ -11,7 +11,7 @@ except ImportError:
|
||||
pass
|
||||
|
||||
# Import Salt Libs
|
||||
import salt.utils
|
||||
import salt.utils.functools
|
||||
import salt.utils.itertools
|
||||
import salt.utils.stringutils
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
@ -26,8 +26,8 @@ def __virtual__():
|
||||
if (__grains__.get('kernel') != 'Darwin' or
|
||||
__grains__['osrelease_info'] < (10, 7)):
|
||||
return (False, 'The mac_group execution module cannot be loaded: only available on Darwin-based systems >= 10.7')
|
||||
_dscl = salt.utils.namespaced_function(_dscl, globals())
|
||||
_flush_dscl_cache = salt.utils.namespaced_function(
|
||||
_dscl = salt.utils.functools.namespaced_function(_dscl, globals())
|
||||
_flush_dscl_cache = salt.utils.functools.namespaced_function(
|
||||
_flush_dscl_cache, globals()
|
||||
)
|
||||
return __virtualname__
|
||||
|
@ -37,8 +37,8 @@ import logging
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this when alias_function is removed
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.pkg
|
||||
import salt.utils.platform
|
||||
@ -180,7 +180,7 @@ def latest_version(*names, **kwargs):
|
||||
return ret
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def remove(name=None, pkgs=None, **kwargs):
|
||||
|
@ -11,12 +11,11 @@ import re
|
||||
import plistlib
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.decorators as decorators
|
||||
import salt.utils.files
|
||||
import salt.utils.path
|
||||
import salt.utils.platform
|
||||
import salt.utils.stringutils
|
||||
import salt.utils.decorators as decorators
|
||||
import salt.utils.files
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
|
||||
|
@ -23,7 +23,6 @@ from salt.ext.six.moves import range # pylint: disable=import-error,redefined-b
|
||||
from salt.ext.six import string_types
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.decorators.path
|
||||
import salt.utils.stringutils
|
||||
|
@ -12,7 +12,7 @@ from __future__ import absolute_import
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.functools
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
from salt.ext.six import integer_types
|
||||
|
||||
@ -238,7 +238,7 @@ def increment(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT):
|
||||
except ValueError:
|
||||
raise SaltInvocationError('Delta value must be an integer')
|
||||
|
||||
incr = salt.utils.alias_function(increment, 'incr')
|
||||
incr = salt.utils.functools.alias_function(increment, 'incr')
|
||||
|
||||
|
||||
def decrement(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT):
|
||||
@ -269,4 +269,4 @@ def decrement(key, delta=1, host=DEFAULT_HOST, port=DEFAULT_PORT):
|
||||
except ValueError:
|
||||
raise SaltInvocationError('Delta value must be an integer')
|
||||
|
||||
decr = salt.utils.alias_function(decrement, 'decr')
|
||||
decr = salt.utils.functools.alias_function(decrement, 'decr')
|
||||
|
@ -13,7 +13,6 @@ import traceback
|
||||
# Import salt libs
|
||||
import salt.crypt
|
||||
import salt.payload
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.event
|
||||
import salt.utils.network
|
||||
@ -212,9 +211,10 @@ def send(func, *args, **kwargs):
|
||||
except IndexError:
|
||||
# Safe error, arg may be in kwargs
|
||||
pass
|
||||
f_call = salt.utils.format_call(__salt__[mine_func],
|
||||
func_data,
|
||||
expected_extra_kws=MINE_INTERNAL_KEYWORDS)
|
||||
f_call = salt.utils.args.format_call(
|
||||
__salt__[mine_func],
|
||||
func_data,
|
||||
expected_extra_kws=MINE_INTERNAL_KEYWORDS)
|
||||
for arg in args:
|
||||
if arg not in f_call['args']:
|
||||
f_call['args'].append(arg)
|
||||
|
@ -13,8 +13,8 @@ import os
|
||||
import socket
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this when alias_function mac_str_to_bytes are moved
|
||||
import salt.utils.decorators.path
|
||||
import salt.utils.functools
|
||||
import salt.utils.files
|
||||
import salt.utils.network
|
||||
import salt.utils.path
|
||||
@ -1038,7 +1038,7 @@ def hw_addr(iface):
|
||||
return salt.utils.network.hw_addr(iface)
|
||||
|
||||
# Alias hwaddr to preserve backward compat
|
||||
hwaddr = salt.utils.alias_function(hw_addr, 'hwaddr')
|
||||
hwaddr = salt.utils.functools.alias_function(hw_addr, 'hwaddr')
|
||||
|
||||
|
||||
def interface(iface):
|
||||
@ -1191,7 +1191,7 @@ def ip_addrs(interface=None, include_loopback=False, cidr=None, type=None):
|
||||
return addrs
|
||||
|
||||
|
||||
ipaddrs = salt.utils.alias_function(ip_addrs, 'ipaddrs')
|
||||
ipaddrs = salt.utils.functools.alias_function(ip_addrs, 'ipaddrs')
|
||||
|
||||
|
||||
def ip_addrs6(interface=None, include_loopback=False, cidr=None):
|
||||
@ -1215,7 +1215,7 @@ def ip_addrs6(interface=None, include_loopback=False, cidr=None):
|
||||
else:
|
||||
return addrs
|
||||
|
||||
ipaddrs6 = salt.utils.alias_function(ip_addrs6, 'ipaddrs6')
|
||||
ipaddrs6 = salt.utils.functools.alias_function(ip_addrs6, 'ipaddrs6')
|
||||
|
||||
|
||||
def get_hostname():
|
||||
|
@ -10,7 +10,6 @@ import logging
|
||||
import time
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.validate.net
|
||||
import salt.exceptions
|
||||
|
||||
|
@ -13,7 +13,6 @@ import json
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
import salt.utils.user
|
||||
import salt.modules.cmdmod
|
||||
|
@ -34,8 +34,8 @@ import tempfile
|
||||
|
||||
# Import Salt libs
|
||||
import salt.defaults.exitcodes
|
||||
import salt.utils
|
||||
import salt.utils.args
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.systemd
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
@ -890,7 +890,7 @@ def list_running():
|
||||
|
||||
# 'machinectl list' shows only running containers, so allow this to work as an
|
||||
# alias to nspawn.list_running
|
||||
list_ = salt.utils.alias_function(list_running, 'list_')
|
||||
list_ = salt.utils.functools.alias_function(list_running, 'list_')
|
||||
|
||||
|
||||
def list_stopped():
|
||||
@ -1263,7 +1263,7 @@ def remove(name, stop=False):
|
||||
|
||||
|
||||
# Compatibility between LXC and nspawn
|
||||
destroy = salt.utils.alias_function(remove, 'destroy')
|
||||
destroy = salt.utils.functools.alias_function(remove, 'destroy')
|
||||
|
||||
|
||||
@_ensure_exists
|
||||
@ -1319,7 +1319,7 @@ def copy_to(name, source, dest, overwrite=False, makedirs=False):
|
||||
overwrite=overwrite,
|
||||
makedirs=makedirs)
|
||||
|
||||
cp = salt.utils.alias_function(copy_to, 'cp')
|
||||
cp = salt.utils.functools.alias_function(copy_to, 'cp')
|
||||
|
||||
|
||||
# Everything below requres systemd >= 219
|
||||
@ -1484,4 +1484,4 @@ def pull_dkr(url, name, index):
|
||||
'''
|
||||
return _pull_image('dkr', url, name, index=index)
|
||||
|
||||
pull_docker = salt.utils.alias_function(pull_dkr, 'pull_docker')
|
||||
pull_docker = salt.utils.functools.alias_function(pull_dkr, 'pull_docker')
|
||||
|
@ -8,14 +8,10 @@ Modify, retrieve, or delete values from OpenStack configuration files.
|
||||
:platform: linux
|
||||
|
||||
'''
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.exceptions
|
||||
|
||||
import salt.utils.decorators.path
|
||||
|
||||
import shlex
|
||||
|
||||
try:
|
||||
import pipes
|
||||
HAS_DEPS = True
|
||||
@ -29,6 +25,10 @@ elif HAS_DEPS and hasattr(pipes, 'quote'):
|
||||
else:
|
||||
_quote = None
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils.decorators.path
|
||||
import salt.exceptions
|
||||
|
||||
# Don't shadow built-in's.
|
||||
__func_alias__ = {
|
||||
'set_': 'set'
|
||||
|
@ -18,11 +18,11 @@ import logging
|
||||
import os.path
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once alias_function, fnmatch_multiple are moved
|
||||
import salt.utils.args
|
||||
import salt.utils.data
|
||||
import salt.utils.pkg
|
||||
import salt.utils.functools
|
||||
import salt.utils.itertools
|
||||
import salt.utils.pkg
|
||||
import salt.utils.systemd
|
||||
from salt.exceptions import CommandExecutionError, MinionError
|
||||
from salt.utils.versions import LooseVersion as _LooseVersion
|
||||
@ -107,7 +107,7 @@ def latest_version(*names, **kwargs):
|
||||
return ret
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def upgrade_available(name):
|
||||
@ -576,7 +576,7 @@ def install(name=None,
|
||||
_available = list_repo_pkgs(*[x[0] for x in wildcards], refresh=refresh)
|
||||
for pkgname, verstr in wildcards:
|
||||
candidates = _available.get(pkgname, [])
|
||||
match = salt.utils.fnmatch_multiple(candidates, verstr)
|
||||
match = salt.utils.itertools.fnmatch_multiple(candidates, verstr)
|
||||
if match is not None:
|
||||
targets.append('='.join((pkgname, match)))
|
||||
else:
|
||||
|
@ -23,6 +23,7 @@ import yaml
|
||||
import json
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils.functools
|
||||
import salt.utils.pagerduty
|
||||
from salt.ext.six import string_types
|
||||
|
||||
@ -121,7 +122,7 @@ def list_windows(profile=None, api_key=None):
|
||||
|
||||
|
||||
# The long version, added for consistency
|
||||
list_maintenance_windows = salt.utils.alias_function(list_windows, 'list_maintenance_windows')
|
||||
list_maintenance_windows = salt.utils.functools.alias_function(list_windows, 'list_maintenance_windows')
|
||||
|
||||
|
||||
def list_policies(profile=None, api_key=None):
|
||||
@ -143,7 +144,7 @@ def list_policies(profile=None, api_key=None):
|
||||
|
||||
|
||||
# The long version, added for consistency
|
||||
list_escalation_policies = salt.utils.alias_function(list_policies, 'list_escalation_policies')
|
||||
list_escalation_policies = salt.utils.functools.alias_function(list_policies, 'list_escalation_policies')
|
||||
|
||||
|
||||
def create_event(service_key=None, description=None, details=None,
|
||||
|
@ -13,7 +13,6 @@ Pacemaker/Cororsync conifguration system (PCS)
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
from salt.ext import six
|
||||
|
||||
|
@ -20,7 +20,6 @@ except ImportError:
|
||||
from pipes import quote as _quote_args
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -17,10 +17,10 @@ from salt.ext import six
|
||||
|
||||
# Import salt libs
|
||||
import salt.pillar
|
||||
import salt.utils # TODO: Remove this once alias_function is moved
|
||||
import salt.utils.crypt
|
||||
import salt.utils.data
|
||||
import salt.utils.dictupdate
|
||||
import salt.utils.functools
|
||||
import salt.utils.odict
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
from salt.exceptions import CommandExecutionError
|
||||
@ -267,7 +267,7 @@ def items(*args, **kwargs):
|
||||
return pillar.compile_pillar()
|
||||
|
||||
# Allow pillar.data to also be used to return pillar data
|
||||
data = salt.utils.alias_function(items, 'data')
|
||||
data = salt.utils.functools.alias_function(items, 'data')
|
||||
|
||||
|
||||
def _obfuscate_inner(var):
|
||||
|
@ -17,8 +17,8 @@ import os
|
||||
import re
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this when alias_function is moved
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.path
|
||||
import salt.utils.pkg
|
||||
import salt.utils.decorators as decorators
|
||||
@ -195,7 +195,7 @@ def latest_version(*names, **kwargs):
|
||||
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def version(*names, **kwargs):
|
||||
|
@ -44,9 +44,9 @@ import logging
|
||||
import os
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once alias_function is moved
|
||||
import salt.utils.data
|
||||
import salt.utils.files
|
||||
import salt.utils.functools
|
||||
import salt.utils.itertools
|
||||
import salt.utils.pkg
|
||||
import salt.utils.versions
|
||||
@ -217,7 +217,7 @@ def version(*names, **kwargs):
|
||||
])
|
||||
|
||||
# Support pkg.info get version info, since this is the CLI usage
|
||||
info = salt.utils.alias_function(version, 'info')
|
||||
info = salt.utils.functools.alias_function(version, 'info')
|
||||
|
||||
|
||||
def refresh_db(jail=None, chroot=None, root=None, force=False):
|
||||
@ -266,7 +266,7 @@ def refresh_db(jail=None, chroot=None, root=None, force=False):
|
||||
|
||||
|
||||
# Support pkg.update to refresh the db, since this is the CLI usage
|
||||
update = salt.utils.alias_function(refresh_db, 'update')
|
||||
update = salt.utils.functools.alias_function(refresh_db, 'update')
|
||||
|
||||
|
||||
def latest_version(*names, **kwargs):
|
||||
@ -345,7 +345,7 @@ def latest_version(*names, **kwargs):
|
||||
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def list_pkgs(versions_as_list=False,
|
||||
@ -1062,9 +1062,9 @@ def remove(name=None,
|
||||
return ret
|
||||
|
||||
# Support pkg.delete to remove packages, since this is the CLI usage
|
||||
delete = salt.utils.alias_function(remove, 'delete')
|
||||
delete = salt.utils.functools.alias_function(remove, 'delete')
|
||||
# No equivalent to purge packages, use remove instead
|
||||
purge = salt.utils.alias_function(remove, 'purge')
|
||||
purge = salt.utils.functools.alias_function(remove, 'purge')
|
||||
|
||||
|
||||
def upgrade(*names, **kwargs):
|
||||
|
@ -14,8 +14,8 @@ from __future__ import absolute_import
|
||||
import copy
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils # TODO: Remove this once alias_function is moved
|
||||
import salt.utils.data
|
||||
import salt.utils.functools
|
||||
import salt.utils.pkg
|
||||
import salt.utils.versions
|
||||
from salt.exceptions import CommandExecutionError, MinionError
|
||||
@ -241,7 +241,7 @@ def latest_version(*names, **kwargs):
|
||||
return ret
|
||||
|
||||
# available_version is being deprecated
|
||||
available_version = salt.utils.alias_function(latest_version, 'available_version')
|
||||
available_version = salt.utils.functools.alias_function(latest_version, 'available_version')
|
||||
|
||||
|
||||
def install(name=None, refresh=False, version=None, pkgs=None, **kwargs):
|
||||
|
@ -13,7 +13,6 @@ from __future__ import absolute_import
|
||||
import os
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
|
||||
|
||||
|
@ -15,7 +15,6 @@ import time
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.utils.path
|
||||
import salt.crypt
|
||||
|
||||
|
@ -24,9 +24,9 @@ import functools
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import SaltInvocationError
|
||||
import salt.utils # TODO: Remove this when chugid_and_umask is moved
|
||||
import salt.utils.files
|
||||
import salt.utils.path
|
||||
import salt.utils.user
|
||||
import salt.utils.vt
|
||||
|
||||
# Import 3rd-party libs
|
||||
@ -487,7 +487,7 @@ def make_repo(repodir,
|
||||
times_looped = 0
|
||||
error_msg = 'Failed to sign file {0}'.format(abs_file)
|
||||
cmd = 'rpm {0} --addsign {1}'.format(define_gpg_name, abs_file)
|
||||
preexec_fn = functools.partial(salt.utils.chugid_and_umask, runas, None)
|
||||
preexec_fn = functools.partial(salt.utils.user.chugid_and_umask, runas, None)
|
||||
try:
|
||||
stdout, stderr = None, None
|
||||
proc = salt.utils.vt.Terminal(
|
||||
|
@ -184,7 +184,7 @@ def rsync(src,
|
||||
else:
|
||||
raise CommandExecutionError('{0} does not exist'.format(src))
|
||||
else:
|
||||
tmp_src = salt.utils.mkstemp()
|
||||
tmp_src = salt.utils.files.mkstemp()
|
||||
file_src = __salt__['cp.get_file'](_src,
|
||||
tmp_src,
|
||||
saltenv)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user