Merge branch 'develop' of github.com:saltstack/salt into hotfix/use-module-__all__-in-loader

This commit is contained in:
Pedro Algarvio 2013-02-19 08:42:46 +00:00
commit cb662dcb47
18 changed files with 111 additions and 45 deletions

4
debian/copyright vendored
View File

@ -4,7 +4,7 @@ Upstream-Contact: salt-users@googlegroups.com
Source: https://github.com/saltstack/salt
Files: *
Copyright: 2012 Thomas S Hatch <thatch45@gmail.com>
Copyright: 2012-2013 Thomas S Hatch <thatch45@gmail.com>
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -41,6 +41,6 @@ License: Apache-2.0
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache Licens, Version 2.0 can be
On Debian systems, the full text of the Apache License, Version 2.0 can be
found in the file
`/usr/share/common-licenses/Apache-2.0'.

View File

@ -213,7 +213,7 @@ Add information about the module using the following field lists:
:depends: python-mysqldb
:platform: all
The maintaner field is a comma-delimited list of developers who help maintain
The maintainer field is a comma-delimited list of developers who help maintain
this module.
The maturity field indicates the level of quality and testing for this module.
@ -222,7 +222,7 @@ Standard labels will be determined.
The depends field is a comma-delimited list of modules that this module depends
on.
The platform field is a comma-delimited list of platforms that this modules is
The platform field is a comma-delimited list of platforms that this module is
known to run on.
How Functions are Read

View File

@ -18,6 +18,7 @@ Full list of builtin state modules
file
gem
git
grains
group
hg
host

View File

@ -0,0 +1,6 @@
==================
salt.states.grains
==================
.. automodule:: salt.states.grains
:members:

View File

@ -139,11 +139,12 @@ vhosts file is changed:
.. code-block:: yaml
include:
- apache
- apache.apache
extend:
apache:
service:
- running
- watch:
- file: /etc/httpd/extra/httpd-vhosts.conf
@ -166,11 +167,12 @@ rewritten as follows:
:emphasize-lines: 8,10,12
include:
- apache
- apache.apache
extend:
apache:
service:
- running
- watch:
- file: mywebsite

View File

@ -108,7 +108,7 @@ class SaltCMD(parsers.SaltCMDOptionParser):
ret, out = self._format_ret(full_ret)
self._output_ret(ret, out)
except (SaltInvocationError, EauthAuthenticationError) as exc:
ret = exc
ret = str(exc)
out = ''
self._output_ret(ret, out)

View File

@ -169,7 +169,17 @@ class LocalClient(object):
)
# Failed to connect to the master and send the pub
if not 'jid' in pub_data or pub_data['jid'] == '0':
if not 'jid' in pub_data:
return {}
if pub_data['jid'] == '0':
print('Failed to connect to the Master, '
'is the Salt Master running?')
return {}
# Check for no minions
if not pub_data['minions']:
print('No minions matched the target. '
'No command was sent, no jid was assigned.')
return {}
return pub_data
@ -338,8 +348,8 @@ class LocalClient(object):
except KeyboardInterrupt:
msg = ('Exiting on Ctrl-C\nThis job\'s jid is:\n{0}\n'
'The minions may not have all finished running and any '
'remaining minions will return upon completion. To look '
'up the return data for this job later run:\n'
'remaining minions will return upon completion. To '
'look up the return data for this job later run:\n'
'salt-run jobs.lookup_jid {0}').format(pub_data['jid'])
raise SystemExit(msg)

View File

@ -57,11 +57,15 @@ class Fileserver(object):
'''
Return the backend list
'''
ret = []
if not back:
back = self.opts['fileserver_backend']
if isinstance(back, str):
back = [back]
return back
for sub in back:
if '{0}.envs'.format(sub) in self.servers:
ret.append(sub)
return ret
def update(self, back=None):
'''

View File

@ -641,17 +641,22 @@ class Loader(object):
log.warning(
'{0}.__virtual__() is wrongly '
'returning `None`. It should either '
'return `True` or `False`. If '
'you\'re the developer of the module '
'{1!r}, please fix this.'.format(
'return `True`, `False` or a new '
'name. If you\'re the developer '
'of the module {1!r}, please fix '
'this.'.format(
mod.__name__,
module_name
)
)
continue
if module_name != virtual:
# update the module name with the new name
if virtual is not True and module_name != virtual:
# If __virtual__ returned True the module will
# be loaded with the same name, if it returned
# other value than `True`, it should be a new
# name for the module.
# Update the module name with the new name
log.debug(
'Loaded {0} as virtual {1}'.format(
module_name, virtual

View File

@ -1691,6 +1691,21 @@ class ClearFuncs(object):
if not clear_load.pop('key') == self.key[getpass.getuser()]:
log.warning('Authentication failure of type "other" ocurred.')
return ''
# Retrieve the minions list
minions = self.ckminions.check_minions(
clear_load['tgt'],
clear_load.get('tgt_type', 'glob')
)
# Check for no minions
if not minions:
return {
'enc': 'clear',
'load': {
'jid': None,
'minions': minions
}
}
# Retrieve the jid
if not clear_load['jid']:
clear_load['jid'] = salt.utils.prep_jid(
self.opts['cachedir'],
@ -1766,10 +1781,6 @@ class ClearFuncs(object):
)
pub_sock.connect(pull_uri)
pub_sock.send(self.serial.dumps(payload))
minions = self.ckminions.check_minions(
load['tgt'],
load.get('tgt_type', 'glob')
)
return {
'enc': 'clear',
'load': {

View File

@ -644,12 +644,23 @@ class Minion(object):
'''
Lock onto the publisher. This is the main event loop for the minion
'''
log.info(
'{0} is starting as user \'{1}\''.format(
self.__class__.__name__,
getpass.getuser()
try:
log.info(
'{0} is starting as user \'{1}\''.format(
self.__class__.__name__,
getpass.getuser()
)
)
except Exception, err:
# Only windows is allowed to fail here. See #3189. Log as debug in
# that case. Else, error.
log.log(
salt.utils.is_windows() and logging.DEBUG or logging.ERROR,
'Failed to get the user who is starting {0}'.format(
self.__class__.__name__
),
exc_info=err
)
)
log.debug('Minion "{0}" trying to tune in'.format(self.opts['id']))
self.context = zmq.Context()

View File

@ -54,7 +54,7 @@ def uninstall(pecls):
def update(pecls):
'''
Update one or several pecl exntesions.
Update one or several pecl extensions.
pecls
The pecl extensions to update.

View File

@ -119,17 +119,18 @@ def list_pkgs(*args):
salt '*' pkg.list_pkgs
'''
pythoncom.CoInitialize()
if len(args) == 0:
pkgs = dict(
list(_get_reg_software().items()) +
list(_get_msi_software().items()))
else:
# get package version for each package in *args
pkgs = {}
for arg in args:
pkgs.update(_search_software(arg))
pythoncom.CoUninitialize()
pkgs = {}
with salt.utils.winapi.Com():
if len(args) == 0:
for key, val in _get_reg_software().iteritems():
__salt__['pkg_resource.add_pkg'](pkgs, key, val)
for key, val in _get_msi_software().iteritems():
__salt__['pkg_resource.add_pkg'](pkgs, key, val)
else:
# get package version for each package in *args
for arg in args:
for key, val in _search_software(arg).iteritems():
__salt__['pkg_resource.add_pkg'](pkgs, key, val)
return pkgs

View File

@ -140,7 +140,7 @@ def format_log(ret):
pkg, old, chg[pkg]['new'])
if not msg:
msg = str(ret['changes'])
if ret['result'] == True or ret['result'] == None:
if ret['result'] is True or ret['result'] is None:
log.info(msg)
else:
log.error(msg)

View File

@ -1123,11 +1123,11 @@ def recurse(name,
keep = set()
vdir = set()
srcpath = source[7:]
for fn_ in __salt__['cp.list_master'](env):
if not fn_.strip():
continue
srcpath = source[7:]
if not fn_.startswith(srcpath):
if not fn_.startswith('{0}{1}'.format(srcpath, os.path.sep)):
continue
# fn_ here is the absolute source path of the file to copy from;
# it is either a normal file or an empty dir(if include_empty==true).

View File

@ -2,10 +2,10 @@
Interaction with Git repositories.
==================================
NOTE: This modules is under heavy development and the API is subject to change.
NOTE: This module is under heavy development and the API is subject to change.
It may be replaced with a generic VCS module if this proves viable.
Important, before using git over ssh, make sure your remote host fingerprint
Important: Before using git over ssh, make sure your remote host fingerprint
exists in "~/.ssh/known_hosts" file.
.. code-block:: yaml

View File

@ -1,5 +1,20 @@
'''
Manage grains on the minion. This state allows for grains to be set and unset
Manage grains on the minion.
============================
This state allows for grains to be set. If a grain with the
given name exists, its value is updated to the new value. If
a grain does not yet exist, a new grain is set to the given
value. Grains set or altered this way are stored in the 'grains'
file on the minions, by default at: /etc/salt/grains
Note: This does NOT override any grains set in the minion file.
.. code-block:: yaml
cheese:
grain.present:
- value: edam
'''
def present(name, value):

View File

@ -201,8 +201,8 @@ class CkMinions(object):
def validate_tgt(self, valid, expr, expr_form):
'''
Return a Bool. This function returns if the expresion sent in is within
the scope of the valid expression
Return a Bool. This function returns if the expression sent in is
within the scope of the valid expression
'''
ref = {'G': 'grain',
'P': 'grain_pcre',