Change default mutable arguments of Mic_RepoData.__init__.
authorHuang Hao <hao.h.huang@intel.com>
Wed, 6 Mar 2013 04:06:07 +0000 (12:06 +0800)
committerGerrit Code Review <gerrit2@otctools.jf.intel.com>
Tue, 12 Mar 2013 06:16:23 +0000 (23:16 -0700)
Only pass arguments includepkgs, excludepkgs, baseurl,
mirrorlist, name to super __init__ if they are not false.
If they are not present the super __init__ will choose proper
default values for those arguments.

W0102: 26,4:Mic_RepoData.__init__: Dangerous default value [] as argument
W0102: 26,4:Mic_RepoData.__init__: Dangerous default value [] as argument

Change-Id: I56db875ee3d42213726a147a46f9d2e998025cce

mic/kickstart/custom_commands/micrepo.py

index eed9a56..b31576e 100644 (file)
@@ -23,14 +23,28 @@ from pykickstart.options import *
 from pykickstart.commands.repo import *
 
 class Mic_RepoData(F8_RepoData):
-    def __init__(self, baseurl="", mirrorlist="", name="", priority=None,
-                 includepkgs=[], excludepkgs=[], save=False, proxy=None,
+
+    def __init__(self, baseurl="", mirrorlist=None, name="", priority=None,
+                 includepkgs=(), excludepkgs=(), save=False, proxy=None,
                  proxy_username=None, proxy_password=None, debuginfo=False,
                  source=False, gpgkey=None, disable=False, ssl_verify="yes",
                  nocache=False):
-        F8_RepoData.__init__(self, baseurl=baseurl, mirrorlist=mirrorlist,
-                             name=name,  includepkgs=includepkgs,
-                             excludepkgs=excludepkgs)
+        kw = {}
+        # F8_RepoData keywords
+        if includepkgs:
+            kw['includepkgs'] = includepkgs
+        if excludepkgs:
+            kw['excludepkgs'] = excludepkgs
+
+        #FC6_RepoData keywords
+        if baseurl:
+            kw['baseurl'] = baseurl
+        if mirrorlist:
+            kw['mirrorlist'] = mirrorlist
+        if name:
+            kw['name'] = name
+
+        F8_RepoData.__init__(self, **kw)
         self.save = save
         self.proxy = proxy
         self.proxy_username = proxy_username