summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-15 21:33:55 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-15 21:33:55 -0700
commit450261a1fcf1f8929a2f7a25c2c278ba40689289 (patch)
tree83430d74ea63c5a11df3fb774e281d0f8efce8f3 /cloudinit/distros/__init__.py
parent784edb7689d60b81a4334d5171603841cc83da98 (diff)
downloadvyos-cloud-init-450261a1fcf1f8929a2f7a25c2c278ba40689289.tar.gz
vyos-cloud-init-450261a1fcf1f8929a2f7a25c2c278ba40689289.zip
Fixups to ensure that pylint does not find anything major wrong.
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r--cloudinit/distros/__init__.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 90607668..fd4c70c1 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -20,29 +20,32 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from StringIO import StringIO
+
import abc
import copy
from cloudinit import importer
+from cloudinit import log as logging
from cloudinit import util
-from StringIO import StringIO
-
# TODO: Make this via config??
IFACE_ACTIONS = {
'up': ['ifup', '--all'],
'down': ['ifdown', '--all'],
}
+LOG = logging.getLogger(__name__)
+
class Distro(object):
__metaclass__ = abc.ABCMeta
- def __init__(self, cfg, runner):
+ def __init__(self, name, cfg, runner):
self._runner = runner
- self._cfg = util.get_cfg_by_path(cfg, ('system_info', ), {})
- self.name = self._cfg.pop("distro", 'generic')
+ self._cfg = cfg
+ self.name = name
@abc.abstractmethod
def install_packages(self, pkglist):
@@ -135,10 +138,9 @@ class Distro(object):
action, cmd)
(_out, err) = util.subp(cmd)
if len(err):
- LOG.warn("Running %s resulted in stderr output: %s",
- IF_UP_CMD, err)
+ LOG.warn("Running %s resulted in stderr output: %s", cmd, err)
return True
- except util.ProcessExecutionError as exc:
+ except util.ProcessExecutionError:
util.logexc(LOG, "Running %s failed", cmd)
return False
@@ -152,7 +154,8 @@ def fetch(distro_name, mods=(__name__, )):
except RuntimeError:
pass
if not mod:
- raise RuntimeError("No distribution found for distro %s" % (distro_name))
+ raise RuntimeError("No distribution found for distro %s"
+ % (distro_name))
distro_cls = getattr(mod, 'Distro')
return distro_cls