Merge branch 'develop' of https://github.com/saltstack/salt into develop

This commit is contained in:
Jack Kuan 2012-08-16 11:58:23 -04:00
commit 280d703f48
4 changed files with 45 additions and 20 deletions

View File

@ -182,3 +182,26 @@ Common YAML Gotchas
An extensive list of
:doc:`YAML idiosyncrasies</topics/troubleshooting/yaml_idiosyncrasies>`
has been compiled.
Live Python Debug Output
========================
If the minion or master seems to be unresponsive, a SIGUSR1 can be passed to
the processes to display where in the code they are running. If encountering a
situation like this, this debug information can be invaluable. First make
sure the master of minion are running in the foreground:
.. code-block:: bash
# salt-master -l debug
# salt-minion -l debug
The pass the signal to the master or minion when it seems to be unresponsive:
.. code-block:: bash
killall -SIGUSR1 salt-master
killall -SIGUSR1 salt-minion
When filing an issue or sending questions to the mailing list for a problem
with an unresponsive daemon this information can be invaluable.

View File

@ -7,7 +7,7 @@ def __virtual__():
'''
Set the virtual pkg module if the os is openSUSE
'''
return 'pkg' if __grains__['os_family'] == 'Suse' else False
return 'pkg' if __grains__.get('os_family', '') == 'Suse' else False
def _list_removed(old, new):

View File

@ -25,10 +25,23 @@ __all__ = ('get_outputter', 'get_printout')
log = logging.getLogger(__name__)
def strip_clean(returns):
'''
Check for the state_verbose option and strip out the result=True
and changes={} members of the state return list.
'''
rm_tags = []
for tag in returns:
if returns[tag]['result'] and not returns[tag]['changes']:
rm_tags.append(tag)
for tag in rm_tags:
returns.pop(tag)
return returns
def get_printout(ret, out, opts, indent=None):
"""
'''
Return the proper printout
"""
'''
if isinstance(ret, list) or isinstance(ret, dict):
if opts['raw_out']:
return get_outputter('raw')
@ -46,7 +59,7 @@ def get_printout(ret, out, opts, indent=None):
return None
# Pretty print any salt exceptions
elif isinstance(ret, SaltException):
return get_outputter("txt")
return get_outputter('txt')
def display_output(ret, out, opts):
'''
@ -95,6 +108,10 @@ class HighStateOutputter(Outputter):
hstrs.append(('{0}----------\n {1}{2[ENDC]}'
.format(hcolor, err, colors)))
if isinstance(data[host], dict):
# Strip out the result: True, without changes returns if
# state_verbose is False
if not self.opts.get('state_verbose', False):
data[host] = strip_clean(data[host])
# Verify that the needed data is present
for tname, info in data[host].items():
if not '__run_num__' in info:

View File

@ -267,21 +267,6 @@ class State(object):
elif data['state'] == 'pkg':
_refresh()
def format_verbosity(self, returns):
'''
Check for the state_verbose option and strip out the result=True
and changes={} members of the state return list.
'''
if self.opts['state_verbose']:
return returns
rm_tags = []
for tag in returns:
if returns[tag]['result'] and not returns[tag]['changes']:
rm_tags.append(tag)
for tag in rm_tags:
returns.pop(tag)
return returns
def verify_data(self, data):
'''
Verify the data, return an error statement if something is wrong
@ -1032,7 +1017,7 @@ class State(object):
# the low data chunks
if errors:
return errors
ret = self.format_verbosity(self.call_chunks(chunks))
ret = self.call_chunks(chunks)
return ret
def call_template(self, template):