Commit b3216b56 authored by Jay Faulkner's avatar Jay Faulkner

fix(pep8): Fix various pep8 violations and version-lock pep8

Fixed all complaints from running "make pep8". Also version locked
pep8 in test-requirements.txt to ensure that pep8 requirements don't
change without an explicit commit.
parent 190cacc4
...@@ -235,7 +235,7 @@ def find_apt_mirror_info(cloud, cfg): ...@@ -235,7 +235,7 @@ def find_apt_mirror_info(cloud, cfg):
mirror = util.search_for_mirror(search) mirror = util.search_for_mirror(search)
if (not mirror and if (not mirror and
util.get_cfg_option_bool(cfg, "apt_mirror_search_dns", False)): util.get_cfg_option_bool(cfg, "apt_mirror_search_dns", False)):
mydom = "" mydom = ""
doms = [] doms = []
......
...@@ -43,7 +43,7 @@ def handle(name, cfg, cloud, log, args): ...@@ -43,7 +43,7 @@ def handle(name, cfg, cloud, log, args):
valid = ("enable-user", "enable-system", "enable", valid = ("enable-user", "enable-system", "enable",
"disable-user", "disable-system", "disable") "disable-user", "disable-system", "disable")
if not value in valid: if value not in valid:
log.warn("Unknown value %s for byobu_by_default", value) log.warn("Unknown value %s for byobu_by_default", value)
mod_user = value.endswith("-user") mod_user = value.endswith("-user")
......
...@@ -87,7 +87,8 @@ def handle(name, cfg, cloud, log, _args): ...@@ -87,7 +87,8 @@ def handle(name, cfg, cloud, log, _args):
# If chef is not installed, we install chef based on 'install_type' # If chef is not installed, we install chef based on 'install_type'
if (not os.path.isfile('/usr/bin/chef-client') or if (not os.path.isfile('/usr/bin/chef-client') or
util.get_cfg_option_bool(chef_cfg, 'force_install', default=False)): util.get_cfg_option_bool(chef_cfg,
'force_install', default=False)):
install_type = util.get_cfg_option_str(chef_cfg, 'install_type', install_type = util.get_cfg_option_str(chef_cfg, 'install_type',
'packages') 'packages')
......
...@@ -271,7 +271,7 @@ def find_device_node(device, fs_type=None, label=None, valid_targets=None, ...@@ -271,7 +271,7 @@ def find_device_node(device, fs_type=None, label=None, valid_targets=None,
return ('/dev/%s' % d['name'], False) return ('/dev/%s' % d['name'], False)
if (d['fstype'] == fs_type and if (d['fstype'] == fs_type and
((label_match and d['label'] == label) or not label_match)): ((label_match and d['label'] == label) or not label_match)):
# If we find a matching device, we return that # If we find a matching device, we return that
return ('/dev/%s' % d['name'], True) return ('/dev/%s' % d['name'], True)
...@@ -447,7 +447,7 @@ def get_partition_mbr_layout(size, layout): ...@@ -447,7 +447,7 @@ def get_partition_mbr_layout(size, layout):
return "0," return "0,"
if ((len(layout) == 0 and isinstance(layout, list)) or if ((len(layout) == 0 and isinstance(layout, list)) or
not isinstance(layout, list)): not isinstance(layout, list)):
raise Exception("Partition layout is invalid") raise Exception("Partition layout is invalid")
last_part_num = len(layout) last_part_num = len(layout)
......
...@@ -36,7 +36,8 @@ def handle(_name, cfg, _cloud, log, _args): ...@@ -36,7 +36,8 @@ def handle(_name, cfg, _cloud, log, _args):
"grub-pc/install_devices_empty", None) "grub-pc/install_devices_empty", None)
if ((os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda")) or if ((os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda")) or
(os.path.exists("/dev/xvda1") and not os.path.exists("/dev/xvda"))): (os.path.exists("/dev/xvda1")
and not os.path.exists("/dev/xvda"))):
if idevs is None: if idevs is None:
idevs = "" idevs = ""
if idevs_empty is None: if idevs_empty is None:
......
...@@ -47,7 +47,7 @@ def handle(name, cfg, cloud, log, args): ...@@ -47,7 +47,7 @@ def handle(name, cfg, cloud, log, args):
if len(args) != 0: if len(args) != 0:
ph_cfg = util.read_conf(args[0]) ph_cfg = util.read_conf(args[0])
else: else:
if not 'phone_home' in cfg: if 'phone_home' not in cfg:
log.debug(("Skipping module named %s, " log.debug(("Skipping module named %s, "
"no 'phone_home' configuration found"), name) "no 'phone_home' configuration found"), name)
return return
......
...@@ -105,7 +105,7 @@ def handle(name, cfg, _cloud, log, args): ...@@ -105,7 +105,7 @@ def handle(name, cfg, _cloud, log, args):
container = util.is_container() container = util.is_container()
if (devpth == "/dev/root" and not os.path.exists(devpth) and if (devpth == "/dev/root" and not os.path.exists(devpth) and
not container): not container):
devpth = rootdev_from_cmdline(util.get_cmdline()) devpth = rootdev_from_cmdline(util.get_cmdline())
if devpth is None: if devpth is None:
log.warn("Unable to find device '/dev/root'") log.warn("Unable to find device '/dev/root'")
......
...@@ -18,22 +18,22 @@ ...@@ -18,22 +18,22 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
## #
## The purpose of this script is to allow cloud-init to consume # The purpose of this script is to allow cloud-init to consume
## rightscale style userdata. rightscale user data is key-value pairs # rightscale style userdata. rightscale user data is key-value pairs
## in a url-query-string like format. # in a url-query-string like format.
## #
## for cloud-init support, there will be a key named # for cloud-init support, there will be a key named
## 'CLOUD_INIT_REMOTE_HOOK'. # 'CLOUD_INIT_REMOTE_HOOK'.
## #
## This cloud-config module will # This cloud-config module will
## - read the blob of data from raw user data, and parse it as key/value # - read the blob of data from raw user data, and parse it as key/value
## - for each key that is found, download the content to # - for each key that is found, download the content to
## the local instance/scripts directory and set them executable. # the local instance/scripts directory and set them executable.
## - the files in that directory will be run by the user-scripts module # - the files in that directory will be run by the user-scripts module
## Therefore, this must run before that. # Therefore, this must run before that.
## #
## #
import os import os
...@@ -58,7 +58,7 @@ def handle(name, _cfg, cloud, log, _args): ...@@ -58,7 +58,7 @@ def handle(name, _cfg, cloud, log, _args):
try: try:
mdict = parse_qs(ud) mdict = parse_qs(ud)
if not mdict or not MY_HOOKNAME in mdict: if mdict or MY_HOOKNAME not in mdict:
log.debug(("Skipping module %s, " log.debug(("Skipping module %s, "
"did not find %s in parsed" "did not find %s in parsed"
" raw userdata"), name, MY_HOOKNAME) " raw userdata"), name, MY_HOOKNAME)
......
...@@ -35,7 +35,7 @@ def handle(name, cfg, cloud, log, _args): ...@@ -35,7 +35,7 @@ def handle(name, cfg, cloud, log, _args):
# *.* @@syslogd.example.com # *.* @@syslogd.example.com
# process 'rsyslog' # process 'rsyslog'
if not 'rsyslog' in cfg: if 'rsyslog' not in cfg:
log.debug(("Skipping module named %s," log.debug(("Skipping module named %s,"
" no 'rsyslog' key in configuration"), name) " no 'rsyslog' key in configuration"), name)
return return
...@@ -46,7 +46,7 @@ def handle(name, cfg, cloud, log, _args): ...@@ -46,7 +46,7 @@ def handle(name, cfg, cloud, log, _args):
files = [] files = []
for i, ent in enumerate(cfg['rsyslog']): for i, ent in enumerate(cfg['rsyslog']):
if isinstance(ent, dict): if isinstance(ent, dict):
if not "content" in ent: if "content" not in ent:
log.warn("No 'content' entry in config entry %s", i + 1) log.warn("No 'content' entry in config entry %s", i + 1)
continue continue
content = ent['content'] content = ent['content']
......
...@@ -75,7 +75,7 @@ def handle(_name, cfg, cloud, log, _args): ...@@ -75,7 +75,7 @@ def handle(_name, cfg, cloud, log, _args):
util.write_file(tgt_fn, val, tgt_perms) util.write_file(tgt_fn, val, tgt_perms)
for (priv, pub) in PRIV_2_PUB.iteritems(): for (priv, pub) in PRIV_2_PUB.iteritems():
if pub in cfg['ssh_keys'] or not priv in cfg['ssh_keys']: if pub in cfg['ssh_keys'] or priv not in cfg['ssh_keys']:
continue continue
pair = (KEY_2_FILE[priv][0], KEY_2_FILE[pub][0]) pair = (KEY_2_FILE[priv][0], KEY_2_FILE[pub][0])
cmd = ['sh', '-xc', KEY_GEN_TPL % pair] cmd = ['sh', '-xc', KEY_GEN_TPL % pair]
......
...@@ -55,7 +55,7 @@ def _gen_fingerprint(b64_text, hash_meth='md5'): ...@@ -55,7 +55,7 @@ def _gen_fingerprint(b64_text, hash_meth='md5'):
def _is_printable_key(entry): def _is_printable_key(entry):
if any([entry.keytype, entry.base64, entry.comment, entry.options]): if any([entry.keytype, entry.base64, entry.comment, entry.options]):
if (entry.keytype and if (entry.keytype and
entry.keytype.lower().strip() in ['ssh-dss', 'ssh-rsa']): entry.keytype.lower().strip() in ['ssh-dss', 'ssh-rsa']):
return True return True
return False return False
......
...@@ -42,7 +42,7 @@ def _format_repo_value(val): ...@@ -42,7 +42,7 @@ def _format_repo_value(val):
return val return val
## TODO(harlowja): move to distro? # TODO(harlowja): move to distro?
# See man yum.conf # See man yum.conf
def _format_repository_config(repo_id, repo_config): def _format_repository_config(repo_id, repo_config):
to_be = configobj.ConfigObj() to_be = configobj.ConfigObj()
...@@ -89,7 +89,7 @@ def handle(name, cfg, _cloud, log, _args): ...@@ -89,7 +89,7 @@ def handle(name, cfg, _cloud, log, _args):
repo_config = n_repo_config repo_config = n_repo_config
missing_required = 0 missing_required = 0
for req_field in ['baseurl']: for req_field in ['baseurl']:
if not req_field in repo_config: if req_field not in repo_config:
log.warn(("Repository %s does not contain a %s" log.warn(("Repository %s does not contain a %s"
" configuration 'required' entry"), " configuration 'required' entry"),
repo_id, req_field) repo_id, req_field)
......
...@@ -167,7 +167,7 @@ class Distro(object): ...@@ -167,7 +167,7 @@ class Distro(object):
def expand_osfamily(family_list): def expand_osfamily(family_list):
distros = [] distros = []
for family in family_list: for family in family_list:
if not family in OSFAMILIES: if family not in OSFAMILIES:
raise ValueError("No distibutions found for osfamily %s" raise ValueError("No distibutions found for osfamily %s"
% (family)) % (family))
distros.extend(OSFAMILIES[family]) distros.extend(OSFAMILIES[family])
...@@ -218,7 +218,7 @@ class Distro(object): ...@@ -218,7 +218,7 @@ class Distro(object):
fn) fn)
if (sys_hostname and prev_hostname and if (sys_hostname and prev_hostname and
sys_hostname != prev_hostname): sys_hostname != prev_hostname):
LOG.debug("%s differs from %s, assuming user maintained hostname.", LOG.debug("%s differs from %s, assuming user maintained hostname.",
prev_hostname_fn, sys_fn) prev_hostname_fn, sys_fn)
......
...@@ -53,7 +53,7 @@ class Merger(object): ...@@ -53,7 +53,7 @@ class Merger(object):
def _on_list(self, value, merge_with): def _on_list(self, value, merge_with):
if (self._method == 'replace' and if (self._method == 'replace' and
not isinstance(merge_with, (tuple, list))): not isinstance(merge_with, (tuple, list))):
return merge_with return merge_with
# Ok we now know that what we are merging with is a list or tuple. # Ok we now know that what we are merging with is a list or tuple.
......
...@@ -452,7 +452,7 @@ def load_azure_ovf_pubkeys(sshnode): ...@@ -452,7 +452,7 @@ def load_azure_ovf_pubkeys(sshnode):
continue continue
if (len(child.childNodes) != 1 or if (len(child.childNodes) != 1 or
child.childNodes[0].nodeType != text_node): child.childNodes[0].nodeType != text_node):
continue continue
cur[name] = child.childNodes[0].wholeText.strip() cur[name] = child.childNodes[0].wholeText.strip()
...@@ -521,7 +521,7 @@ def read_azure_ovf(contents): ...@@ -521,7 +521,7 @@ def read_azure_ovf(contents):
simple = False simple = False
value = "" value = ""
if (len(child.childNodes) == 1 and if (len(child.childNodes) == 1 and
child.childNodes[0].nodeType == dom.TEXT_NODE): child.childNodes[0].nodeType == dom.TEXT_NODE):
simple = True simple = True
value = child.childNodes[0].wholeText value = child.childNodes[0].wholeText
......
...@@ -181,7 +181,7 @@ class DataSourceNoCloud(sources.DataSource): ...@@ -181,7 +181,7 @@ class DataSourceNoCloud(sources.DataSource):
# and the source of the seed was self.dsmode # and the source of the seed was self.dsmode
# ('local' for NoCloud, 'net' for NoCloudNet') # ('local' for NoCloud, 'net' for NoCloudNet')
if ('network-interfaces' in mydata['meta-data'] and if ('network-interfaces' in mydata['meta-data'] and
(self.dsmode in ("local", seeded_interfaces))): (self.dsmode in ("local", seeded_interfaces))):
LOG.debug("Updating network interfaces from %s", self) LOG.debug("Updating network interfaces from %s", self)
self.distro.apply_network( self.distro.apply_network(
mydata['meta-data']['network-interfaces']) mydata['meta-data']['network-interfaces'])
......
...@@ -107,7 +107,7 @@ class DataSourceOVF(sources.DataSource): ...@@ -107,7 +107,7 @@ class DataSourceOVF(sources.DataSource):
return True return True
def get_public_ssh_keys(self): def get_public_ssh_keys(self):
if not 'public-keys' in self.metadata: if 'public-keys' not in self.metadata:
return [] return []
pks = self.metadata['public-keys'] pks = self.metadata['public-keys']
if isinstance(pks, (list)): if isinstance(pks, (list)):
...@@ -205,7 +205,7 @@ def transport_iso9660(require_iso=True): ...@@ -205,7 +205,7 @@ def transport_iso9660(require_iso=True):
fullp = os.path.join("/dev/", dev) fullp = os.path.join("/dev/", dev)
if (fullp in mounts or if (fullp in mounts or
not cdmatch.match(dev) or os.path.isdir(fullp)): not cdmatch.match(dev) or os.path.isdir(fullp)):
continue continue
try: try:
......
...@@ -41,7 +41,7 @@ import serial ...@@ -41,7 +41,7 @@ import serial
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
SMARTOS_ATTRIB_MAP = { SMARTOS_ATTRIB_MAP = {
#Cloud-init Key : (SmartOS Key, Strip line endings) # Cloud-init Key : (SmartOS Key, Strip line endings)
'local-hostname': ('hostname', True), 'local-hostname': ('hostname', True),
'public-keys': ('root_authorized_keys', True), 'public-keys': ('root_authorized_keys', True),
'user-script': ('user-script', False), 'user-script': ('user-script', False),
...@@ -96,21 +96,21 @@ BUILTIN_CLOUD_CONFIG = { ...@@ -96,21 +96,21 @@ BUILTIN_CLOUD_CONFIG = {
'device': 'ephemeral0'}], 'device': 'ephemeral0'}],
} }
## builtin vendor-data is a boothook that writes a script into # builtin vendor-data is a boothook that writes a script into
## /var/lib/cloud/scripts/per-boot. *That* script then handles # /var/lib/cloud/scripts/per-boot. *That* script then handles
## executing the 'operator-script' and 'user-script' files # executing the 'operator-script' and 'user-script' files
## that cloud-init writes into /var/lib/cloud/instance/data/ # that cloud-init writes into /var/lib/cloud/instance/data/
## if they exist. # if they exist.
## #
## This is all very indirect, but its done like this so that at # This is all very indirect, but its done like this so that at
## some point in the future, perhaps cloud-init wouldn't do it at # some point in the future, perhaps cloud-init wouldn't do it at
## all, but rather the vendor actually provide vendor-data that accomplished # all, but rather the vendor actually provide vendor-data that accomplished
## their desires. (That is the point of vendor-data). # their desires. (That is the point of vendor-data).
## #
## cloud-init does cheat a bit, and write the operator-script and user-script # cloud-init does cheat a bit, and write the operator-script and user-script
## itself. It could have the vendor-script do that, but it seems better # itself. It could have the vendor-script do that, but it seems better
## to not require the image to contain a tool (mdata-get) to read those # to not require the image to contain a tool (mdata-get) to read those
## keys when we have a perfectly good one inside cloud-init. # keys when we have a perfectly good one inside cloud-init.
BUILTIN_VENDOR_DATA = """\ BUILTIN_VENDOR_DATA = """\
#cloud-boothook #cloud-boothook
#!/bin/sh #!/bin/sh
......
...@@ -166,7 +166,7 @@ class DataSource(object): ...@@ -166,7 +166,7 @@ class DataSource(object):
defhost = "localhost" defhost = "localhost"
domain = defdomain domain = defdomain
if not self.metadata or not 'local-hostname' in self.metadata: if self.metadata or 'local-hostname' not in self.metadata:
# this is somewhat questionable really. # this is somewhat questionable really.
# the cloud datasource was asked for a hostname # the cloud datasource was asked for a hostname
# and didn't have one. raising error might be more appropriate # and didn't have one. raising error might be more appropriate
......
...@@ -642,7 +642,7 @@ class Modules(object): ...@@ -642,7 +642,7 @@ class Modules(object):
# Try the modules frequency, otherwise fallback to a known one # Try the modules frequency, otherwise fallback to a known one
if not freq: if not freq:
freq = mod.frequency freq = mod.frequency
if not freq in FREQUENCIES: if freq not in FREQUENCIES:
freq = PER_INSTANCE freq = PER_INSTANCE
LOG.debug("Running module %s (%s) with frequency %s", LOG.debug("Running module %s (%s) with frequency %s",
name, mod, freq) name, mod, freq)
......
...@@ -237,8 +237,8 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1, ...@@ -237,8 +237,8 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
return UrlResponse(r) return UrlResponse(r)
except exceptions.RequestException as e: except exceptions.RequestException as e:
if (isinstance(e, (exceptions.HTTPError)) if (isinstance(e, (exceptions.HTTPError))
and hasattr(e, 'response') # This appeared in v 0.10.8 and hasattr(e, 'response') # This appeared in v 0.10.8
and hasattr(e.response, 'status_code')): and hasattr(e.response, 'status_code')):
excps.append(UrlError(e, code=e.response.status_code, excps.append(UrlError(e, code=e.response.status_code,
headers=e.response.headers)) headers=e.response.headers))
else: else:
......
...@@ -423,7 +423,7 @@ def get_cfg_option_list(yobj, key, default=None): ...@@ -423,7 +423,7 @@ def get_cfg_option_list(yobj, key, default=None):
@return: The configuration option as a list of strings or default if key @return: The configuration option as a list of strings or default if key
is not found. is not found.
""" """
if not key in yobj: if key not in yobj:
return default return default
if yobj[key] is None: if yobj[key] is None:
return [] return []
...@@ -1148,7 +1148,7 @@ def chownbyname(fname, user=None, group=None): ...@@ -1148,7 +1148,7 @@ def chownbyname(fname, user=None, group=None):
# this returns the specific 'mode' entry, cleanly formatted, with value # this returns the specific 'mode' entry, cleanly formatted, with value
def get_output_cfg(cfg, mode): def get_output_cfg(cfg, mode):
ret = [None, None] ret = [None, None]
if not cfg or not 'output' in cfg: if cfg or 'output' not in cfg:
return ret return ret
outcfg = cfg['output'] outcfg = cfg['output']
...@@ -1745,7 +1745,7 @@ def parse_mount_info(path, mountinfo_lines, log=LOG): ...@@ -1745,7 +1745,7 @@ def parse_mount_info(path, mountinfo_lines, log=LOG):
# Ignore mount points higher than an already seen mount # Ignore mount points higher than an already seen mount
# point. # point.
if (match_mount_point_elements is not None and if (match_mount_point_elements is not None and
len(match_mount_point_elements) > len(mount_point_elements)): len(match_mount_point_elements) > len(mount_point_elements)):
continue continue
# Find the '-' which terminates a list of optional columns to # Find the '-' which terminates a list of optional columns to
......
...@@ -235,7 +235,7 @@ class TestAzureDataSource(MockerTestCase): ...@@ -235,7 +235,7 @@ class TestAzureDataSource(MockerTestCase):
self.assertEqual(dsrc.userdata_raw, mydata) self.assertEqual(dsrc.userdata_raw, mydata)
def test_no_datasource_expected(self): def test_no_datasource_expected(self):
#no source should be found if no seed_dir and no devs # no source should be found if no seed_dir and no devs
data = {} data = {}
dsrc = self._get_ds({}) dsrc = self._get_ds({})
ret = dsrc.get_data() ret = dsrc.get_data()
......
...@@ -50,7 +50,7 @@ class TestNoCloudDataSource(MockerTestCase): ...@@ -50,7 +50,7 @@ class TestNoCloudDataSource(MockerTestCase):
self.assertTrue(ret) self.assertTrue(ret)
def test_fs_label(self): def test_fs_label(self):
#find_devs_with should not be called ff fs_label is None # find_devs_with should not be called ff fs_label is None
ds = DataSourceNoCloud.DataSourceNoCloud ds = DataSourceNoCloud.DataSourceNoCloud
class PsuedoException(Exception): class PsuedoException(Exception):
...@@ -74,7 +74,7 @@ class TestNoCloudDataSource(MockerTestCase): ...@@ -74,7 +74,7 @@ class TestNoCloudDataSource(MockerTestCase):
self.assertFalse(ret) self.assertFalse(ret)
def test_no_datasource_expected(self): def test_no_datasource_expected(self):
#no source should be found if no cmdline, config, and fs_label=None # no source should be found if no cmdline, config, and fs_label=None
sys_cfg = {'datasource': {'NoCloud': {'fs_label': None}}} sys_cfg = {'datasource': {'NoCloud': {'fs_label': None}}}
ds = DataSourceNoCloud.DataSourceNoCloud ds = DataSourceNoCloud.DataSourceNoCloud
......
...@@ -193,7 +193,7 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase): ...@@ -193,7 +193,7 @@ class TestGenericDistro(helpers.FilesystemMockingTestCase):
'security': 'http://security-mirror2-intel'}) 'security': 'http://security-mirror2-intel'})
#def _get_package_mirror_info(mirror_info, availability_zone=None, # def _get_package_mirror_info(mirror_info, availability_zone=None,
# mirror_filter=util.search_for_mirror): # mirror_filter=util.search_for_mirror):
......
...@@ -53,7 +53,7 @@ class TestDisabled(MockerTestCase): ...@@ -53,7 +53,7 @@ class TestDisabled(MockerTestCase):
self.handle = cc_growpart.handle self.handle = cc_growpart.handle
def test_mode_off(self): def test_mode_off(self):
#Test that nothing is done if mode is off. # Test that nothing is done if mode is off.
# this really only verifies that resizer_factory isn't called # this really only verifies that resizer_factory isn't called
config = {'growpart': {'mode': 'off'}} config = {'growpart': {'mode': 'off'}}
...@@ -109,7 +109,7 @@ class TestConfig(MockerTestCase): ...@@ -109,7 +109,7 @@ class TestConfig(MockerTestCase):
self.assertTrue(isinstance(ret, cc_growpart.ResizeGrowPart)) self.assertTrue(isinstance(ret, cc_growpart.ResizeGrowPart))
def test_handle_with_no_growpart_entry(self): def test_handle_with_no_growpart_entry(self):
#if no 'growpart' entry in config, then mode=auto should be used # if no 'growpart' entry in config, then mode=auto should be used
myresizer = object() myresizer = object()
...@@ -141,7 +141,7 @@ class TestResize(MockerTestCase): ...@@ -141,7 +141,7 @@ class TestResize(MockerTestCase):
self.mocker.order() self.mocker.order()
def test_simple_devices(self): def test_simple_devices(self):
#test simple device list # test simple device list
# this patches out devent2dev, os.stat, and device_part_info # this patches out devent2dev, os.stat, and device_part_info
# so in the end, doesn't test a lot # so in the end, doesn't test a lot
devs = ["/dev/XXda1", "/dev/YYda2"] devs = ["/dev/XXda1", "/dev/YYda2"]
...@@ -187,7 +187,7 @@ class TestResize(MockerTestCase): ...@@ -187,7 +187,7 @@ class TestResize(MockerTestCase):
find("/dev/YYda2", resized)[1]) find("/dev/YYda2", resized)[1])
self.assertEqual(cc_growpart.RESIZE.SKIPPED, self.assertEqual(cc_growpart.RESIZE.SKIPPED,
find(enoent[0], resized)[1]) find(enoent[0], resized)[1])
#self.assertEqual(resize_calls, # self.assertEqual(resize_calls,
# [("/dev/XXda", "1", "/dev/XXda1"), # [("/dev/XXda", "1", "/dev/XXda1"),
# ("/dev/YYda", "2", "/dev/YYda2")]) # ("/dev/YYda", "2", "/dev/YYda2")])
finally: finally:
......
...@@ -67,7 +67,7 @@ def check_lps_ret(psc_return, mode=None): ...@@ -67,7 +67,7 @@ def check_lps_ret(psc_return, mode=None):
cmd = psc_return[0] cmd = psc_return[0]
timeout = psc_return[1] timeout = psc_return[1]
if not 'shutdown' in psc_return[0][0]: if 'shutdown' not in psc_return[0][0]:
errs.append("string 'shutdown' not in cmd") errs.append("string 'shutdown' not in cmd")
if mode is not None: if mode is not None:
......
...@@ -24,7 +24,7 @@ class TestConfig(helpers.FilesystemMockingTestCase): ...@@ -24,7 +24,7 @@ class TestConfig(helpers.FilesystemMockingTestCase):
'epel-testing': { 'epel-testing': {
'name': 'Extra Packages for Enterprise Linux 5 - Testing', 'name': 'Extra Packages for Enterprise Linux 5 - Testing',
# Missing this should cause the repo not to be written # Missing this should cause the repo not to be written
#'baseurl': 'http://blah.org/pub/epel/testing/5/$basearch', # 'baseurl': 'http://blah.org/pub/epel/testing/5/$basearch',
'enabled': False, 'enabled': False,
'gpgcheck': True, 'gpgcheck': True,
'gpgkey': 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL', 'gpgkey': 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL',
......
...@@ -71,7 +71,7 @@ def cloud_import_alphabetical(physical_line, line_number, lines): ...@@ -71,7 +71,7 @@ def cloud_import_alphabetical(physical_line, line_number, lines):
# with or without "as y" # with or without "as y"
length = [2, 4] length = [2, 4]
if (len(split_line) in length and len(split_previous) in length and if (len(split_line) in length and len(split_previous) in length and
split_line[0] == "import" and split_previous[0] == "import"): split_line[0] == "import" and split_previous[0] == "import"):
if split_line[1] < split_previous[1]: if split_line[1] < split_previous[1]:
return (0, "N306: imports not in alphabetical order (%s, %s)" return (0, "N306: imports not in alphabetical order (%s, %s)"
% (split_previous[1], split_line[1])) % (split_previous[1], split_line[1]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment