mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Windows: Fix usage of pkgrepo state
`pkgrepo.py` contains this line: ``` from salt.modules.aptpkg import _strip_uri ``` However, `salt.modules.aptpkg` is just not importable on Windows. Instead of trying to make this module importable on Windows (which clearly isn't the intent of the module), placed a copy of `_strip_uri` into `pkgrepo.py` as this is a small function. Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
This commit is contained in:
parent
e38f313ac0
commit
f54c7a6f01
1 changed files with 13 additions and 1 deletions
|
@ -92,7 +92,7 @@ import sys
|
|||
|
||||
# Import salt libs
|
||||
from salt.exceptions import CommandExecutionError, SaltInvocationError
|
||||
from salt.modules.aptpkg import _strip_uri
|
||||
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
|
||||
from salt.state import STATE_INTERNAL_KEYWORDS as _STATE_INTERNAL_KEYWORDS
|
||||
import salt.utils
|
||||
import salt.utils.pkg.deb
|
||||
|
@ -106,6 +106,18 @@ def __virtual__():
|
|||
return 'pkg.mod_repo' in __salt__
|
||||
|
||||
|
||||
def _strip_uri(repo):
|
||||
'''
|
||||
Remove the trailing slash from the URI in a repo definition
|
||||
'''
|
||||
splits = repo.split()
|
||||
for idx in range(len(splits)):
|
||||
if any(splits[idx].startswith(x)
|
||||
for x in ('http://', 'https://', 'ftp://')):
|
||||
splits[idx] = splits[idx].rstrip('/')
|
||||
return ' '.join(splits)
|
||||
|
||||
|
||||
def managed(name, ppa=None, **kwargs):
|
||||
'''
|
||||
This state manages software package repositories. Currently, :mod:`yum
|
||||
|
|
Loading…
Add table
Reference in a new issue