mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
blast, put the try/except int he right place
This commit is contained in:
parent
be1a7659a3
commit
aa1f45d664
1 changed files with 12 additions and 12 deletions
|
@ -165,18 +165,18 @@ def _check_pkg_version_format(pkg):
|
|||
)
|
||||
)
|
||||
return ret
|
||||
try:
|
||||
ret['prefix'] = install_req.req.project_name
|
||||
ret['version_spec'] = install_req.req.specs
|
||||
except Exception:
|
||||
if install_req.req is None:
|
||||
# This is most likely an url and there's no way to know what will
|
||||
# be installed before actually installing it.
|
||||
ret['result'] = True
|
||||
ret['prefix'] = ''
|
||||
ret['version_spec'] = []
|
||||
else:
|
||||
ret['result'] = True
|
||||
if install_req.req is None:
|
||||
# This is most likely an url and there's no way to know what will
|
||||
# be installed before actually installing it.
|
||||
ret['result'] = True
|
||||
ret['prefix'] = ''
|
||||
ret['version_spec'] = []
|
||||
else:
|
||||
ret['result'] = True
|
||||
try:
|
||||
ret['prefix'] = install_req.req.project_name
|
||||
ret['version_spec'] = install_req.req.specs
|
||||
except Exception:
|
||||
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
|
||||
if hasattr(install_req, "specifier"):
|
||||
specifier = install_req.specifier
|
||||
|
|
Loading…
Add table
Reference in a new issue