summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-15 22:50:12 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-15 22:50:12 -0400
commitd4b587ebf500ddc2259fffc94a3c69c199c9a427 (patch)
tree987a743859aadb4bf2ad3daf0cc9e62afc92294c
parent8311e8f7a2d4ad782015c0eb4d22efd0c5a8af0f (diff)
downloadvyos-cloud-init-d4b587ebf500ddc2259fffc94a3c69c199c9a427.tar.gz
vyos-cloud-init-d4b587ebf500ddc2259fffc94a3c69c199c9a427.zip
fix some errors reported by pylint
pylint --errors-only found several errors. Some of the changes here represent real errors, others just code that pylint did not like.
-rw-r--r--cloudinit/config/cc_apt_configure.py3
-rw-r--r--cloudinit/config/cc_growpart.py10
-rw-r--r--cloudinit/distros/__init__.py2
-rw-r--r--cloudinit/distros/arch.py4
-rw-r--r--cloudinit/sources/DataSourceOVF.py10
-rw-r--r--cloudinit/sources/DataSourceOpenNebula.py2
-rw-r--r--cloudinit/sources/helpers/openstack.py2
7 files changed, 17 insertions, 16 deletions
diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py
index 96c4a43d..05ad4b03 100644
--- a/cloudinit/config/cc_apt_configure.py
+++ b/cloudinit/config/cc_apt_configure.py
@@ -208,8 +208,9 @@ def add_apt_sources(srclist, template_params=None, aa_repo_match=None):
template_params = {}
if aa_repo_match is None:
- def aa_repo_match(x):
+ def _aa_repo_match(x):
return False
+ aa_repo_match = _aa_repo_match
errorlist = []
srcdict = convert_to_new_format(srclist)
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index 859d69f1..40560f11 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -36,13 +36,13 @@ DEFAULT_CONFIG = {
}
-def enum(**enums):
- return type('Enum', (), enums)
+class RESIZE(object):
+ SKIPPED = "SKIPPED"
+ CHANGED = "CHANGED"
+ NOCHANGE = "NOCHANGE"
+ FAILED = "FAILED"
-RESIZE = enum(SKIPPED="SKIPPED", CHANGED="CHANGED", NOCHANGE="NOCHANGE",
- FAILED="FAILED")
-
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 5c29c804..14b500f8 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -454,7 +454,7 @@ class Distro(object):
keys = kwargs['ssh_authorized_keys']
if isinstance(keys, six.string_types):
keys = [keys]
- if isinstance(keys, dict):
+ elif isinstance(keys, dict):
keys = list(keys.values())
if keys is not None:
if not isinstance(keys, (tuple, list, set)):
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index 93a2e008..66209f22 100644
--- a/cloudinit/distros/arch.py
+++ b/cloudinit/distros/arch.py
@@ -196,6 +196,6 @@ def convert_resolv_conf(settings):
"""Returns a settings string formatted for resolv.conf."""
result = ''
if isinstance(settings, list):
- for ns in list:
+ for ns in settings:
result = result + 'nameserver %s\n' % ns
- return result
+ return result
diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py
index f2bb9366..43347cfb 100644
--- a/cloudinit/sources/DataSourceOVF.py
+++ b/cloudinit/sources/DataSourceOVF.py
@@ -37,16 +37,16 @@ from cloudinit.sources.helpers.vmware.imc.config_file \
import ConfigFile
from cloudinit.sources.helpers.vmware.imc.config_nic \
import NicConfigurator
+from cloudinit.sources.helpers.vmware.imc.guestcust_error \
+ import GuestCustErrorEnum
from cloudinit.sources.helpers.vmware.imc.guestcust_event \
import GuestCustEventEnum
from cloudinit.sources.helpers.vmware.imc.guestcust_state \
import GuestCustStateEnum
-from cloudinit.sourceshelpers.vmware.imc.guestcust_error \
- import GuestCustErrorEnum
-from cloudinit.sourceshelpers.vmware.imc.guestcust_util import (
- set_customization_status,
+from cloudinit.sources.helpers.vmware.imc.guestcust_util import (
+ enable_nics,
get_nics_to_enable,
- enable_nics
+ set_customization_status
)
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 8f85b115..7b3a76b9 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -104,7 +104,7 @@ class DataSourceOpenNebula(sources.DataSource):
def get_hostname(self, fqdn=False, resolve_ip=None):
if resolve_ip is None:
- if self.dsmode == sources.DSMODE_NET:
+ if self.dsmode == sources.DSMODE_NETWORK:
resolve_ip = True
else:
resolve_ip = False
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index 494335b3..d52cb56a 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -157,7 +157,7 @@ class BaseReader(object):
pass
@abc.abstractmethod
- def _path_read(self, path):
+ def _path_read(self, path, decode=False):
pass
@abc.abstractmethod