diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-01-12 16:54:54 +0100 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-01-12 16:54:54 +0100 |
commit | 6a2031c4dc005d9a0f42b10200b828eee5cf166f (patch) | |
tree | a57029f73b060b9e8ab6068d326f939dc479d191 /cloudinit/CloudConfig | |
parent | 234cefd314a7e1cfb51fad3bdf344d801a8b238d (diff) | |
download | vyos-cloud-init-6a2031c4dc005d9a0f42b10200b828eee5cf166f.tar.gz vyos-cloud-init-6a2031c4dc005d9a0f42b10200b828eee5cf166f.zip |
[PATCH 06/13] Fix pylint warnings W0612 (unused variable)
From: Juerg Haefliger <juerg.haefliger@hp.com>
Diffstat (limited to 'cloudinit/CloudConfig')
-rw-r--r-- | cloudinit/CloudConfig/cc_apt_update_upgrade.py | 4 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_chef.py | 1 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_resizefs.py | 4 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_rightscale_userdata.py | 3 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_rsyslog.py | 4 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_set_hostname.py | 4 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_set_passwords.py | 2 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_update_etc_hosts.py | 2 | ||||
-rw-r--r-- | cloudinit/CloudConfig/cc_update_hostname.py | 4 |
9 files changed, 12 insertions, 16 deletions
diff --git a/cloudinit/CloudConfig/cc_apt_update_upgrade.py b/cloudinit/CloudConfig/cc_apt_update_upgrade.py index e9fd2c07..22651067 100644 --- a/cloudinit/CloudConfig/cc_apt_update_upgrade.py +++ b/cloudinit/CloudConfig/cc_apt_update_upgrade.py @@ -121,7 +121,7 @@ def rename_apt_lists(omirror,new_mirror,lists_d="/var/lib/apt/lists"): os.rename(file,"%s%s" % (nprefix, file[olen:])) def get_release(): - stdout, stderr = subprocess.Popen(['lsb_release', '-cs'], stdout=subprocess.PIPE).communicate() + stdout, _stderr = subprocess.Popen(['lsb_release', '-cs'], stdout=subprocess.PIPE).communicate() return(stdout.strip()) def generate_sources_list(codename, mirror): @@ -202,7 +202,7 @@ def find_apt_mirror(cloud, cfg): if not mirror and cloud: # if we have a fqdn, then search its domain portion first - ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud) + ( _hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud) mydom = ".".join(fqdn.split(".")[1:]) if mydom: doms.append(".%s" % mydom) diff --git a/cloudinit/CloudConfig/cc_chef.py b/cloudinit/CloudConfig/cc_chef.py index 6b8e3825..977fe80f 100644 --- a/cloudinit/CloudConfig/cc_chef.py +++ b/cloudinit/CloudConfig/cc_chef.py @@ -41,7 +41,6 @@ def handle(_name,cfg,cloud,log,_args): with open('/etc/chef/validation.pem', 'w') as validation_key_fh: validation_key_fh.write(validation_key) - validation_name = chef_cfg.get('validation_name','chef-validator') # create the chef config from template util.render_to_file('chef_client.rb', '/etc/chef/client.rb', {'server_url': chef_cfg['server_url'], diff --git a/cloudinit/CloudConfig/cc_resizefs.py b/cloudinit/CloudConfig/cc_resizefs.py index d4b260b8..adec70be 100644 --- a/cloudinit/CloudConfig/cc_resizefs.py +++ b/cloudinit/CloudConfig/cc_resizefs.py @@ -53,7 +53,7 @@ def handle(_name,cfg,_cloud,log,args): cmd = [ 'blkid', '-c', '/dev/null', '-sTYPE', '-ovalue', devpth ] try: - (fstype,err) = util.subp(cmd) + (fstype,_err) = util.subp(cmd) except subprocess.CalledProcessError as e: log.warn("Failed to get filesystem type of maj=%s, min=%s via: %s" % (os.major(st_dev), os.minor(st_dev), cmd)) @@ -74,7 +74,7 @@ def handle(_name,cfg,_cloud,log,args): return try: - (out,err) = util.subp(resize_cmd) + util.subp(resize_cmd) except subprocess.CalledProcessError as e: log.warn("Failed to resize filesystem (%s)" % resize_cmd) log.warn("output=%s\nerror=%s\n", e.output[0], e.output[1]) diff --git a/cloudinit/CloudConfig/cc_rightscale_userdata.py b/cloudinit/CloudConfig/cc_rightscale_userdata.py index 050d89aa..2b43023c 100644 --- a/cloudinit/CloudConfig/cc_rightscale_userdata.py +++ b/cloudinit/CloudConfig/cc_rightscale_userdata.py @@ -50,7 +50,7 @@ def handle(_name,_cfg,cloud,log,_args): return try: - mdict = parse_qs(cloud.get_userdata_raw()) + mdict = parse_qs(ud) if not my_hookname in mdict: return except: log.warn("failed to urlparse.parse_qa(userdata_raw())") @@ -58,7 +58,6 @@ def handle(_name,_cfg,cloud,log,_args): scripts_d = get_ipath_cur('scripts') i = 0 - errors = [ ] first_e = None for url in mdict[my_hookname]: fname = "%s/rightscale-%02i" % (scripts_d,i) diff --git a/cloudinit/CloudConfig/cc_rsyslog.py b/cloudinit/CloudConfig/cc_rsyslog.py index 4e427ae0..ab85a6d8 100644 --- a/cloudinit/CloudConfig/cc_rsyslog.py +++ b/cloudinit/CloudConfig/cc_rsyslog.py @@ -38,8 +38,6 @@ def handle(_name,cfg,_cloud,log,_args): def_dir = cfg.get('rsyslog_dir', DEF_DIR) def_fname = cfg.get('rsyslog_filename', DEF_FILENAME) - entries = cfg['rsyslog'] - files = [ ] elst = [ ] for ent in cfg['rsyslog']: @@ -80,7 +78,7 @@ def handle(_name,cfg,_cloud,log,_args): # it will also return failure on the attempt, so 'restarted' # won't get set log.debug("restarting rsyslog") - p = util.subp(['service', 'rsyslog', 'restart']) + util.subp(['service', 'rsyslog', 'restart']) restarted = True except Exception as e: diff --git a/cloudinit/CloudConfig/cc_set_hostname.py b/cloudinit/CloudConfig/cc_set_hostname.py index 129e9165..4f19b0c8 100644 --- a/cloudinit/CloudConfig/cc_set_hostname.py +++ b/cloudinit/CloudConfig/cc_set_hostname.py @@ -23,10 +23,10 @@ def handle(_name,cfg,cloud,log,_args): log.debug("preserve_hostname is set. not setting hostname") return(True) - ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud) + ( hostname, _fqdn ) = util.get_hostname_fqdn(cfg, cloud) try: set_hostname(hostname, log) - except Exception as e: + except Exception: util.logexc(log) log.warn("failed to set hostname to %s\n", hostname) diff --git a/cloudinit/CloudConfig/cc_set_passwords.py b/cloudinit/CloudConfig/cc_set_passwords.py index f44d450c..07e3ca1b 100644 --- a/cloudinit/CloudConfig/cc_set_passwords.py +++ b/cloudinit/CloudConfig/cc_set_passwords.py @@ -115,7 +115,7 @@ def handle(_name,cfg,_cloud,log,args): return def rand_str(strlen=32, select_from=string.letters+string.digits): - return("".join([random.choice(select_from) for x in range(0, strlen)])) + return("".join([random.choice(select_from) for _x in range(0, strlen)])) def rand_user_password(pwlen=9): selfrom=(string.letters.translate(None,'loLOI') + diff --git a/cloudinit/CloudConfig/cc_update_etc_hosts.py b/cloudinit/CloudConfig/cc_update_etc_hosts.py index 9e3a1dbb..1c245e67 100644 --- a/cloudinit/CloudConfig/cc_update_etc_hosts.py +++ b/cloudinit/CloudConfig/cc_update_etc_hosts.py @@ -34,7 +34,7 @@ def handle(_name,cfg,cloud,log,_args): util.render_to_file('hosts', '/etc/hosts', \ { 'hostname' : hostname, 'fqdn' : fqdn }) - except Exception as e: + except Exception: log.warn("failed to update /etc/hosts") raise elif manage_hosts == "localhost": diff --git a/cloudinit/CloudConfig/cc_update_hostname.py b/cloudinit/CloudConfig/cc_update_hostname.py index 871e40bf..4bc1cb2b 100644 --- a/cloudinit/CloudConfig/cc_update_hostname.py +++ b/cloudinit/CloudConfig/cc_update_hostname.py @@ -27,11 +27,11 @@ def handle(_name,cfg,cloud,log,_args): log.debug("preserve_hostname is set. not updating hostname") return - ( hostname, fqdn ) = util.get_hostname_fqdn(cfg, cloud) + ( hostname, _fqdn ) = util.get_hostname_fqdn(cfg, cloud) try: prev ="%s/%s" % (cloud.get_cpath('data'),"previous-hostname") update_hostname(hostname, prev, log) - except Exception as e: + except Exception: log.warn("failed to set hostname\n") raise |