summaryrefslogtreecommitdiff
path: root/plugins/imager/raw_plugin.py
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-08-29 17:28:42 +0800
committerGui Chen <gui.chen@intel.com>2012-08-31 10:47:57 +0800
commit089223389a99e09e8874f028866a40a9adeb2bc5 (patch)
treeefc0ed670ed9429c5791f1df0e97828780a47c6e /plugins/imager/raw_plugin.py
parent69e59d8b14a50aba4e1354c2ec0b58a36a58b533 (diff)
downloadmic-089223389a99e09e8874f028866a40a9adeb2bc5.tar.gz
mic-089223389a99e09e8874f028866a40a9adeb2bc5.tar.bz2
mic-089223389a99e09e8874f028866a40a9adeb2bc5.zip
set default pkgmgr to auto and preferred to use zypp
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'plugins/imager/raw_plugin.py')
-rw-r--r--plugins/imager/raw_plugin.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py
index 8f31c03..b2356d2 100644
--- a/plugins/imager/raw_plugin.py
+++ b/plugins/imager/raw_plugin.py
@@ -71,17 +71,23 @@ class RawPlugin(ImagerPlugin):
# try to find the pkgmgr
pkgmgr = None
- for (key, pcls) in pluginmgr.get_plugins('backend').iteritems():
- if 'auto' == creatoropts['pkgmgr']:
- pkgmgr = pcls
- break
- elif key == creatoropts['pkgmgr']:
- pkgmgr = pcls
- break
+ backends = pluginmgr.get_plugins('backend')
+ if 'auto' == creatoropts['pkgmgr']:
+ for key in configmgr.prefer_backends:
+ if key in backends:
+ pkgmgr = backends[key]
+ break
+ else:
+ for key in backends.keys():
+ if key == creatoropts['pkgmgr']:
+ pkgmgr = backends[key]
+ break
if not pkgmgr:
- pkgmgrs = pluginmgr.get_plugins('backend').keys()
- raise errors.CreatorError("Can't find package manager: %s (availables: %s)" % (creatoropts['pkgmgr'], ', '.join(pkgmgrs)))
+ raise errors.CreatorError("Can't find backend: %s, "
+ "available choices: %s" %
+ (creatoropts['pkgmgr'],
+ ','.join(backends.keys())))
creator = raw.RawImageCreator(creatoropts, pkgmgr, opts.compress_image)