Merge remote-tracking branch 'upstream/2014.7' into merge-forward-2015.5

This commit is contained in:
Colton Myers 2015-05-13 11:49:55 -06:00
commit bd635488ef
8 changed files with 44 additions and 20 deletions

View file

@ -52,8 +52,9 @@ Var MinionName_State
Page custom nsDialogsPage nsDialogsPageLeave
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "sc"
!define MUI_FINISHPAGE_RUN "net"
!define MUI_FINISHPAGE_RUN_PARAMETERS "start salt-minion"
!insertmacro MUI_PAGE_FINISH
@ -246,15 +247,13 @@ Section -Post
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr HKLM "SYSTEM\CurrentControlSet\services\salt-minion" "DependOnService" "nsi"
ExecWait "nssm.exe install salt-minion $INSTDIR\bin\python.exe $INSTDIR\bin\Scripts\salt-minion -c $INSTDIR\conf -l quiet"
RMDir /R "$INSTDIR\var\cache\salt" ; removing cache from old version
Call updateMinionConfig
SectionEnd
Function .onInstSuccess
Exec "nssm.exe install salt-minion $INSTDIR\bin\python.exe $INSTDIR\bin\Scripts\salt-minion -c $INSTDIR\conf -l quiet"
RMDir /R "$INSTDIR\var\cache\salt" ; removing cache from old version
ExecWait "net start salt-minion"
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK

View file

@ -218,7 +218,9 @@ def reap_fileserver_cache_dir(cache_base, find_func):
# This will only remove the directory on the second time
# "_reap_cache" is called (which is intentional)
if len(dirs) == 0 and len(files) == 0:
os.rmdir(root)
# only remove if empty directory is older than 60s
if time.time() - os.path.getctime(root) > 60:
os.rmdir(root)
continue
# if not, lets check the files in the directory
for file_ in files:

View file

@ -1173,10 +1173,16 @@ class LazyLoader(salt.utils.lazy.LazyDict):
end, module_name)
log.warning(msg)
else:
virtual = mod.__virtual__()
if isinstance(virtual, tuple):
error_reason = virtual[1]
virtual = virtual[0]
try:
virtual = mod.__virtual__()
if isinstance(virtual, tuple):
error_reason = virtual[1]
virtual = virtual[0]
except Exception as exc:
log.error('Exception raised when processing __virtual__ function'
' for {0}. Module will not be loaded {1}'.format(
module_name, exc))
virtual = None
# Get the module's virtual name
virtualname = getattr(mod, '__virtualname__', virtual)
if not virtual:

View file

@ -795,6 +795,10 @@ class Minion(MinionBase):
' {0}'.format(opts['master']))
if opts['master_shuffle']:
shuffle(opts['master'])
elif isinstance(opts['master'], str):
# We have a string, but a list was what was intended. Convert.
# See issue 23611 for details
opts['master'] = list(opts['master'])
elif opts['__role'] == 'syndic':
log.info('Syndic setting master_syndic to \'{0}\''.format(opts['master']))

View file

@ -513,6 +513,13 @@ def get_or_set_hash(name,
.. code-block:: bash
salt '*' grains.get_or_set_hash 'django:SECRET_KEY' 50
.. warning::
This function could return strings which may contain characters which are reserved
as directives by the YAML parser, such as strings beginning with `%`. To avoid
issues when using the output of this function in an SLS file containing YAML+Jinja,
surround the call with single quotes.
'''
ret = get(name, None)

View file

@ -209,7 +209,8 @@ class Pillar(object):
),
self.rend,
self.opts['renderer'],
self.opts['environment']
self.opts['environment'],
_pillar_rend=True
)
]
else:
@ -222,7 +223,8 @@ class Pillar(object):
),
self.rend,
self.opts['renderer'],
saltenv=saltenv
saltenv=saltenv,
_pillar_rend=True
)
)
except Exception as exc:
@ -257,7 +259,8 @@ class Pillar(object):
).get('dest', False),
self.rend,
self.opts['renderer'],
saltenv=saltenv
saltenv=saltenv,
_pillar_rend=True
)
)
except Exception as exc:

View file

@ -335,6 +335,7 @@ def _gen_keep_files(name, require):
ret = set()
if os.path.isdir(name):
for root, dirs, files in os.walk(name):
ret.add(name)
for name in files:
ret.add(os.path.join(root, name))
for name in dirs:
@ -346,7 +347,7 @@ def _gen_keep_files(name, require):
required_files = [comp for comp in require if 'file' in comp]
for comp in required_files:
for low in __lowstate__:
if low['__id__'] == comp['file']:
if low['name'] == comp['file']:
fn = low['name']
if os.path.isdir(comp['file']):
if _is_child(comp['file'], name):

View file

@ -18,10 +18,12 @@ def __virtual__():
'''
Load this state if this is the salt-master
'''
return ('winrepo'
if 'salt-master' in __grains__.get('roles', [])
else False)
try:
return ('winrepo'
if 'salt-master' in __grains__.get('roles', [])
else False)
except TypeError:
return False
def genrepo(name, force=False, allow_empty=False):