mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Add support for chocolatey source priority.
https://docs.chocolatey.org/en-us/choco/commands/sources#options-and-switches
This commit is contained in:
parent
939e59abd7
commit
a701418f04
2 changed files with 19 additions and 3 deletions
|
@ -1125,7 +1125,7 @@ def version(name, check_remote=False, source=None, pre_versions=False):
|
|||
return packages
|
||||
|
||||
|
||||
def add_source(name, source_location, username=None, password=None):
|
||||
def add_source(name, source_location, priority=None, username=None, password=None):
|
||||
"""
|
||||
Instructs Chocolatey to add a source.
|
||||
|
||||
|
@ -1135,6 +1135,12 @@ def add_source(name, source_location, username=None, password=None):
|
|||
source
|
||||
Location of the source you want to work with.
|
||||
|
||||
priority
|
||||
The priority order of this source as compared to other sources,
|
||||
lower is better. Defaults to 0 (no priority). All priorities
|
||||
above 0 will be evaluated first, then zero-based values will be
|
||||
evaluated in config file order.
|
||||
|
||||
username
|
||||
Provide username for chocolatey sources that need authentication
|
||||
credentials.
|
||||
|
@ -1148,6 +1154,7 @@ def add_source(name, source_location, username=None, password=None):
|
|||
.. code-block:: bash
|
||||
|
||||
salt '*' chocolatey.add_source <source name> <source_location>
|
||||
salt '*' chocolatey.add_source <source name> <source_location> priority=100
|
||||
salt '*' chocolatey.add_source <source name> <source_location> user=<user> password=<password>
|
||||
|
||||
"""
|
||||
|
@ -1160,6 +1167,8 @@ def add_source(name, source_location, username=None, password=None):
|
|||
"--source",
|
||||
source_location,
|
||||
]
|
||||
if priority:
|
||||
cmd.extend(["--priority", priority])
|
||||
if username:
|
||||
cmd.extend(["--user", username])
|
||||
if password:
|
||||
|
|
|
@ -456,7 +456,7 @@ def upgraded(
|
|||
return ret
|
||||
|
||||
|
||||
def source_present(name, source_location, username=None, password=None, force=False):
|
||||
def source_present(name, source_location, priority=None, username=None, password=None, force=False):
|
||||
"""
|
||||
Instructs Chocolatey to add a source if not already present.
|
||||
|
||||
|
@ -466,6 +466,12 @@ def source_present(name, source_location, username=None, password=None, force=Fa
|
|||
source
|
||||
Location of the source you want to work with.
|
||||
|
||||
priority
|
||||
The priority order of this source as compared to other sources,
|
||||
lower is better. Defaults to 0 (no priority). All priorities
|
||||
above 0 will be evaluated first, then zero-based values will be
|
||||
evaluated in config file order.
|
||||
|
||||
username
|
||||
Provide username for chocolatey sources that need authentication
|
||||
credentials.
|
||||
|
@ -486,6 +492,7 @@ def source_present(name, source_location, username=None, password=None, force=Fa
|
|||
chocolatey.source_present:
|
||||
- name: reponame
|
||||
- source: https://repo.exemple.com
|
||||
- priority: 100
|
||||
- username: myuser
|
||||
- password: mypassword
|
||||
"""
|
||||
|
@ -516,7 +523,7 @@ def source_present(name, source_location, username=None, password=None, force=Fa
|
|||
|
||||
# Add the source
|
||||
result = __salt__["chocolatey.add_source"](
|
||||
name=name, source_location=source_location, username=username, password=password
|
||||
name=name, source_location=source_location, priority=priority, username=username, password=password
|
||||
)
|
||||
|
||||
if "Running chocolatey failed" not in result:
|
||||
|
|
Loading…
Add table
Reference in a new issue