mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #4549 from morganfainberg/4514
Addressing issues in #4514
This commit is contained in:
commit
7977cee270
@ -12,19 +12,25 @@ import json
|
|||||||
# Import salt libs
|
# Import salt libs
|
||||||
import salt.utils
|
import salt.utils
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from aptsources import sourceslist
|
from aptsources import sourceslist
|
||||||
apt_support = True
|
apt_support = True
|
||||||
except ImportError:
|
except ImportError, e:
|
||||||
apt_support = False
|
apt_support = False
|
||||||
|
err_str = 'Unable to import "sourceslist" from "aptsources" module: {0}'
|
||||||
|
log.error(err_str.format(str(e)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import softwareproperties.ppa
|
import softwareproperties.ppa
|
||||||
ppa_format_support = True
|
ppa_format_support = True
|
||||||
except ImportError:
|
except ImportError, e:
|
||||||
ppa_format_support = False
|
ppa_format_support = False
|
||||||
|
err_str = 'Unable to import "softwareproperties.ppa": {0}'
|
||||||
log = logging.getLogger(__name__)
|
log.warning(err_str.format(str(e)))
|
||||||
|
|
||||||
# Source format for urllib fallback on PPA handling
|
# Source format for urllib fallback on PPA handling
|
||||||
LP_SRC_FORMAT = 'deb http://ppa.launchpad.net/{0}/{1}/ubuntu {2} main'
|
LP_SRC_FORMAT = 'deb http://ppa.launchpad.net/{0}/{1}/ubuntu {2} main'
|
||||||
@ -774,8 +780,9 @@ def del_repo(repo, refresh=False, **kwargs):
|
|||||||
is_ppa = True
|
is_ppa = True
|
||||||
dist = __grains__['lsb_codename']
|
dist = __grains__['lsb_codename']
|
||||||
if not ppa_format_support:
|
if not ppa_format_support:
|
||||||
warning_str = 'python-software-properties package not ' \
|
warning_str = 'Unable to use functions from ' \
|
||||||
'installed, making best guess at ppa format: {0}'
|
'"python-software-properties" package, making ' \
|
||||||
|
'best guess at ppa format: {0}'
|
||||||
log.warning(warning_str.format(repo))
|
log.warning(warning_str.format(repo))
|
||||||
owner_name, ppa_name = repo[4:].split('/')
|
owner_name, ppa_name = repo[4:].split('/')
|
||||||
if 'ppa_auth' in kwargs:
|
if 'ppa_auth' in kwargs:
|
||||||
@ -898,8 +905,10 @@ def mod_repo(repo, refresh=False, **kwargs):
|
|||||||
return {repo: out}
|
return {repo: out}
|
||||||
else:
|
else:
|
||||||
if not ppa_format_support:
|
if not ppa_format_support:
|
||||||
log.warning('software-python-properties not installed, '
|
warning_str = 'Unable to use functions from ' \
|
||||||
'falling back to using urllib method for PPA.')
|
'"python-software-properties" package, ' \
|
||||||
|
'making best guess at ppa format: {0}'
|
||||||
|
log.warning(warning_str.format(repo))
|
||||||
else:
|
else:
|
||||||
log.info('falling back to urllib method for private PPA ')
|
log.info('falling back to urllib method for private PPA ')
|
||||||
#fall back to urllib style
|
#fall back to urllib style
|
||||||
|
Loading…
Reference in New Issue
Block a user