Merge pull request #29125 from basepi/merge-forward-2015.8

[2015.8] Merge forward from 2015.5 to 2015.8
This commit is contained in:
Colton Myers 2015-11-23 11:48:46 -07:00
commit 233ab8a474
7 changed files with 44 additions and 19 deletions

View file

@ -28,6 +28,20 @@ pylint_ program as follows:
.. _pylint: http://www.pylint.org
Variables
=========
Variables should be a minimum of three characters and should provide an
easy-to-understand name of the object being represented.
When keys and values are iterated over, descriptive names should be used
to represent the temporary variables.
Multi-word variables should be separated by an underscore.
Variables which are two-letter words should have an underscore appended
to them to pad them to three characters.
Strings
=======
@ -332,4 +346,4 @@ commit, and the changes should be legitimate, if there are any questions about
whether a style change is legitimate please reference this document and the
official PEP 8 (http://legacy.python.org/dev/peps/pep-0008/) document before
changing code. Many claims that a change is PEP 8 have been invalid, please
double check before committing fixes.
double check before committing fixes.

View file

@ -556,23 +556,30 @@ class Client(object):
if url_data.scheme == 's3':
try:
import salt.utils.s3
def s3_opt(key, default=None):
'''Get value of s3.<key> from Minion config or from Pillar'''
if 's3.' + key in self.opts:
return self.opts['s3.' + key]
try:
return self.opts['pillar']['s3'][key]
except (KeyError, TypeError):
return default
salt.utils.s3.query(method='GET',
bucket=url_data.netloc,
path=url_data.path[1:],
return_bin=False,
local_file=dest,
action=None,
key=self.opts.get('s3.key', None),
keyid=self.opts.get('s3.keyid', None),
service_url=self.opts.get('s3.service_url',
None),
verify_ssl=self.opts.get('s3.verify_ssl',
True),
location=self.opts.get('s3.location',
None))
key=s3_opt('key'),
keyid=s3_opt('keyid'),
service_url=s3_opt('service_url'),
verify_ssl=s3_opt('verify_ssl', True),
location=s3_opt('location'))
return dest
except Exception:
raise MinionError('Could not fetch from {0}'.format(url))
except Exception as exc:
raise MinionError('Could not fetch from {0}. Exception: {1}'.format(url, exc))
if url_data.scheme == 'ftp':
try:
ftp = ftplib.FTP(url_data.hostname)

View file

@ -79,7 +79,7 @@ def installed(name, # pylint: disable=C0103
'Use of argument ruby found, but neither rvm or rbenv is installed'
)
gems = __salt__['gem.list'](name, ruby, gem_bin=gem_bin, runas=user)
if name in gems and version is not None and version in gems[name]:
if name in gems and version is not None and str(version) in gems[name]:
ret['result'] = True
ret['comment'] = 'Gem is already installed.'
return ret

View file

@ -16,9 +16,9 @@ Example:
- user
- perms:
- '/':
- '.*'
- '.*'
- '.*'
- '.*'
- '.*'
- '.*'
- runas: rabbitmq
'''

View file

@ -240,6 +240,7 @@ def state(
if 'return' in mdata and 'ret' not in mdata:
mdata['ret'] = mdata.pop('return')
m_state = True
if mdata.get('failed', False):
m_state = False
else:

View file

@ -36,6 +36,9 @@ import salt.utils.locales
# Import 3rd-party libs
import salt.ext.six as six
# Import 3rd-party libs
import salt.ext.six as six
log = logging.getLogger(__name__)

View file

@ -124,10 +124,10 @@ def query(key, keyid, method='GET', params=None, headers=None,
verify=verify_ssl)
response = result.content
except requests.exceptions.HTTPError as exc:
log.error('There was an error::')
if hasattr(exc, 'code') and hasattr(exc, 'msg'):
log.error(' Code: {0}: {1}'.format(exc.code, exc.msg))
log.error(' Content: \n{0}'.format(exc.read()))
log.error('Failed to {0} {1}::'.format(method, requesturl))
log.error(' Exception: {0}'.format(exc))
if exc.response:
log.error(' Response content: {0}'.format(exc.response.content))
return False
log.debug('S3 Response Status Code: {0}'.format(result.status_code))