Merge branch '2016.11' into 'nitrogen'

Conflicts:
  - salt/modules/win_pkg.py
This commit is contained in:
rallytime 2017-04-20 11:21:10 -06:00
commit 0b96d52f71
5 changed files with 57 additions and 21 deletions

View File

@ -91,14 +91,14 @@ A simple list of minion IDs would traditionally be defined like this:
.. code-block:: yaml
nodegroups:
- group1: L@host1,host2,host3
group1: L@host1,host2,host3
They can now also be defined as a YAML list, like this:
.. code-block:: yaml
nodegroups:
- group1:
group1:
- host1
- host2
- host3

View File

@ -461,8 +461,22 @@ Alternatively the ``uninstaller`` can also simply repeat the URL of the msi file
uninstaller: salt://win/repo/7zip/7z920-x64.msi
uninstall_flags: '/qn /norestart'
:param bool msiexec: This tells salt to use ``msiexec /i`` to install the
:param msiexec: This tells salt to use ``msiexec /i`` to install the
package and ``msiexec /x`` to uninstall. This is for `.msi` installations.
Possible options are: True, False or path to msiexec on your system
7zip:
'9.20.00.0':
installer: salt://win/repo/7zip/7z920-x64.msi
full_name: 7-Zip 9.20 (x64 edition)
reboot: False
install_flags: '/qn /norestart'
msiexec: 'C:\Windows\System32\msiexec.exe'
uninstaller: salt://win/repo/7zip/7z920-x64.msi
uninstall_flags: '/qn /norestart'
:param str arch: This selects which ``msiexec.exe`` to use. Possible values:
``x86``, ``x64``
:param bool allusers: This parameter is specific to `.msi` installations. It
tells `msiexec` to install the software for all users. The default is True.

View File

@ -885,6 +885,22 @@ def _get_source_sum(source_hash, file_path, saltenv):
return ret
def _get_msiexec(use_msiexec):
'''
Return if msiexec.exe will be used and the command to invoke it.
'''
if use_msiexec is False:
return (False, '')
if os.path.isfile(use_msiexec):
return (True, use_msiexec)
else:
log.warning(("msiexec path '{0}' not found. Using system registered"
" msiexec instead").format(use_msiexec))
use_msiexec = True
if use_msiexec is True:
return (True, 'msiexec')
def install(name=None, refresh=False, pkgs=None, **kwargs):
r'''
Install the passed package(s) on the system using winrepo
@ -1187,13 +1203,16 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
options.get('extra_install_flags', '')
)
#Compute msiexec string
use_msiexec, msiexec = _get_msiexec(pkginfo[version_num].get('msiexec', False))
# Install the software
# Check Use Scheduler Option
if pkginfo[version_num].get('use_scheduler', False):
# Build Scheduled Task Parameters
if pkginfo[version_num].get('msiexec', False):
cmd = 'msiexec.exe'
if use_msiexec:
cmd = msiexec
arguments = ['/i', cached_pkg]
if pkginfo['version_num'].get('allusers', True):
arguments.append('ALLUSERS="1"')
@ -1223,8 +1242,8 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
else:
# Build the install command
cmd = []
if pkginfo[version_num].get('msiexec', False):
cmd.extend(['msiexec', '/i', cached_pkg])
if use_msiexec:
cmd.extend([msiexec, '/i', cached_pkg])
if pkginfo[version_num].get('allusers', True):
cmd.append('ALLUSERS="1"')
else:
@ -1481,13 +1500,16 @@ def remove(name=None, pkgs=None, version=None, **kwargs):
uninstall_flags = '{0} {1}'.format(
uninstall_flags, kwargs.get('extra_uninstall_flags', ''))
#Compute msiexec string
use_msiexec, msiexec = _get_msiexec(pkginfo[version_num].get('msiexec', False))
# Uninstall the software
# Check Use Scheduler Option
if pkginfo[target].get('use_scheduler', False):
# Build Scheduled Task Parameters
if pkginfo[target].get('msiexec', False):
cmd = 'msiexec.exe'
if use_msiexec:
cmd = msiexec
arguments = ['/x']
arguments.extend(salt.utils.shlex_split(uninstall_flags))
else:
@ -1515,8 +1537,8 @@ def remove(name=None, pkgs=None, version=None, **kwargs):
else:
# Build the install command
cmd = []
if pkginfo[target].get('msiexec', False):
cmd.extend(['msiexec', '/x', expanded_cached_pkg])
if use_msiexec:
cmd.extend([msiexec, '/x', expanded_cached_pkg])
else:
cmd.append(expanded_cached_pkg)
cmd.extend(salt.utils.shlex_split(uninstall_flags))

View File

@ -272,20 +272,20 @@ def update(name,
if account_disabled:
user_info['flags'] |= win32netcon.UF_ACCOUNTDISABLE
else:
user_info['flags'] ^= win32netcon.UF_ACCOUNTDISABLE
user_info['flags'] &= ~win32netcon.UF_ACCOUNTDISABLE
if unlock_account is not None:
if unlock_account:
user_info['flags'] ^= win32netcon.UF_LOCKOUT
user_info['flags'] &= ~win32netcon.UF_LOCKOUT
if password_never_expires is not None:
if password_never_expires:
user_info['flags'] |= win32netcon.UF_DONT_EXPIRE_PASSWD
else:
user_info['flags'] ^= win32netcon.UF_DONT_EXPIRE_PASSWD
user_info['flags'] &= ~win32netcon.UF_DONT_EXPIRE_PASSWD
if disallow_change_password is not None:
if disallow_change_password:
user_info['flags'] |= win32netcon.UF_PASSWD_CANT_CHANGE
else:
user_info['flags'] ^= win32netcon.UF_PASSWD_CANT_CHANGE
user_info['flags'] &= ~win32netcon.UF_PASSWD_CANT_CHANGE
# Apply new settings
try:

View File

@ -72,7 +72,7 @@ Optionally, a root may be specified.
- consul: my_consul_config
ext_pillar:
- consul: my_consul_config root=/salt
- consul: my_consul_config root=salt
Using these configuration profiles, multiple consul sources may also be used:
@ -88,9 +88,9 @@ path to expose minion-specific information stored in consul.
.. code-block:: yaml
ext_pillar:
- consul: my_consul_config root=/salt/%(minion_id)s
- consul: my_consul_config root=/salt/%(role)s
- consul: my_consul_config root=/salt/%(environment)s
- consul: my_consul_config root=salt/%(minion_id)s
- consul: my_consul_config root=salt/%(role)s
- consul: my_consul_config root=salt/%(environment)s
Minion-specific values may override shared values when the minion-specific root
appears after the shared root:
@ -98,8 +98,8 @@ appears after the shared root:
.. code-block:: yaml
ext_pillar:
- consul: my_consul_config root=/salt-shared
- consul: my_other_consul_config root=/salt-private/%(minion_id)s
- consul: my_consul_config root=salt-shared
- consul: my_other_consul_config root=salt-private/%(minion_id)s
If using the ``role`` or ``environment`` grain in the consul key path, be sure to define it using
`/etc/salt/grains`, or similar: