mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #33729 from twangboy/fix_win_servermanager
Add exclude option to win_servermanager
This commit is contained in:
commit
1cf8fe3f1d
2 changed files with 20 additions and 3 deletions
|
@ -117,7 +117,7 @@ def list_installed():
|
|||
return ret
|
||||
|
||||
|
||||
def install(feature, recurse=False, source=None, restart=False):
|
||||
def install(feature, recurse=False, source=None, restart=False, exclude=None):
|
||||
'''
|
||||
Install a feature
|
||||
|
||||
|
@ -140,6 +140,13 @@ def install(feature, recurse=False, source=None, restart=False):
|
|||
:param bool restart: Restarts the computer when installation is complete, if
|
||||
required by the role/feature installed. Default is False
|
||||
|
||||
:param str exclude: The name of the feature to exclude when installing the
|
||||
named feature.
|
||||
|
||||
..note:: As there is no exclude option for the ``Add-WindowsFeature``
|
||||
command, the feature will be installed with other sub-features and
|
||||
will then be removed.
|
||||
|
||||
:return: A dictionary containing the results of the install
|
||||
:rtype: dict
|
||||
|
||||
|
@ -173,6 +180,9 @@ def install(feature, recurse=False, source=None, restart=False):
|
|||
.format(_cmd_quote(feature), mgmt_tools, sub, src, rst)
|
||||
out = _pshell_json(cmd)
|
||||
|
||||
if exclude is not None:
|
||||
remove(exclude, restart=restart)
|
||||
|
||||
if out['FeatureResult']:
|
||||
return {'ExitCode': out['ExitCode'],
|
||||
'DisplayName': out['FeatureResult'][0]['DisplayName'],
|
||||
|
|
|
@ -14,7 +14,12 @@ def __virtual__():
|
|||
return 'win_servermanager' if 'win_servermanager.install' in __salt__ else False
|
||||
|
||||
|
||||
def installed(name, recurse=False, force=False, source=None, restart=False):
|
||||
def installed(name,
|
||||
recurse=False,
|
||||
force=False,
|
||||
source=None,
|
||||
restart=False,
|
||||
exclude=None):
|
||||
'''
|
||||
Install the windows feature
|
||||
|
||||
|
@ -31,6 +36,8 @@ def installed(name, recurse=False, force=False, source=None, restart=False):
|
|||
restart (Optional[bool]): Restarts the computer when installation is
|
||||
complete, if required by the role/feature installed. Default is
|
||||
False
|
||||
exclude (Optional[str]): The name of the feature to exclude when
|
||||
installing the named feature.
|
||||
|
||||
Note:
|
||||
Some features require reboot after un/installation. If so, until the
|
||||
|
@ -78,7 +85,7 @@ def installed(name, recurse=False, force=False, source=None, restart=False):
|
|||
|
||||
# Install the features
|
||||
status = __salt__['win_servermanager.install'](
|
||||
name, recurse, source, restart)
|
||||
name, recurse, source, restart, exclude)
|
||||
|
||||
ret['result'] = status['Success']
|
||||
if not ret['result']:
|
||||
|
|
Loading…
Add table
Reference in a new issue