Commit dea18597 authored by Jérome Perrin's avatar Jérome Perrin

remove unused variables

parent bdce6e76
......@@ -226,7 +226,7 @@ def main():
try:
while True:
section_dict = loadConfiguration(configuration, logger)
loadConfiguration(configuration, logger)
agent_parameter_dict = dict(configuration.items('agent'))
......
......@@ -224,7 +224,6 @@ class HTTPCacheCheckerTestSuite(object):
conditional_header_dict[header] = _formatConfiguration(value)
return conditional_header_dict
validator_dict = {}
no_header_list = getNoCheckHeaderList(url, fetched_data)
conditional_header_dict = getConditionalHeaderDict(url, fetched_data)
conditional_header_list = conditional_header_dict.keys()
......
......@@ -21,7 +21,6 @@ def buildStatistic(history_folder):
for p in glob.glob("%s/*.history.json" % history_folder):
result = {}
stats_list = []
promise_name = p.split("/")[-1].replace(".history.json", "")
stat_file_path = p.replace(".history.json", ".stats.json")
if os.path.exists(stat_file_path):
......
......@@ -270,7 +270,6 @@ def main():
collector = ResourceCollect(parser.collector_db)
date_scope = datetime.now().strftime('%Y-%m-%d')
stat_info = os.stat(parser.output_folder)
partition_user = pwd.getpwuid(stat_info.st_uid)[0]
......
......@@ -32,7 +32,6 @@ class MonitorFeed(object):
def appendItem(self, item_dict, has_string=""):
event_date = item_dict['result']['change-date']
report_date = item_dict['result']['date']
description = item_dict['result'].get('message', '')
guid = base64.b64encode(str2bytes("%s, %s, %s, %s" % (self.hosting_name,
item_dict['title'], has_string, event_date)))
......
......@@ -233,7 +233,7 @@ class Monitoring(object):
monitor_dict = json.loads(bytes2str(response.read()))
monitor_title = monitor_dict.get('title', 'Unknown Instance')
success = True
except ValueError as e:
except ValueError:
print("ERROR: Json file at %s is not valid" % url)
self.bootstrap_is_ok = success
......@@ -276,7 +276,7 @@ class Monitoring(object):
for parameter in parameter_list:
if parameter['key']:
pfile.write('%s = %s\n' % (parameter['key'], parameter['value']))
except OSError as e:
except OSError:
print("Error failed to create file %s" % self.parameter_cfg_file)
......
......@@ -61,8 +61,6 @@ class MonitorConfigWrite(object):
return True
def _httpdCorsDomainWrite(self, httpd_cors_file, httpd_gracefull_bin, cors_domain):
cors_string = ""
cors_domain_list = cors_domain.split()
old_httpd_cors_file = os.path.join(
os.path.dirname(httpd_cors_file),
'prev_%s' % os.path.basename(httpd_cors_file)
......@@ -113,7 +111,6 @@ class MonitorConfigWrite(object):
return {}
new_parameter_list = []
parameter_list = []
description_dict = {}
result_dict = {}
......@@ -155,7 +152,7 @@ class MonitorConfigWrite(object):
for parameter in new_parameter_list:
if parameter['key']:
pfile.write('%s = %s\n' % (parameter['key'], parameter['value']))
except OSError as e:
except OSError:
print("Error failed to create file %s" % self.output_cfg_file)
return result_dict
......@@ -188,7 +185,7 @@ def main():
if status and os.path.exists(parameter_tmp_file):
try:
os.unlink(config_file)
except OSError as e:
except OSError:
print("ERROR cannot remove file: %s" % parameter_tmp_file)
else:
os.rename(parameter_tmp_file, config_file)
......
......@@ -152,7 +152,7 @@ class MonitorPromiseLauncher(object):
exit_code = 0
try:
promise_launcher.run()
except PromiseError as e:
except PromiseError:
# error was already logged
exit_code = 1
if self.config.pid_path:
......
......@@ -27,7 +27,7 @@ def writeJSONFile(pid_dict, db_path):
return
for pid in pid_dict.copy():
try:
process = psutil.Process(int(pid))
psutil.Process(int(pid))
except psutil.NoSuchProcess:
del pid_dict[pid]
......
......@@ -46,7 +46,7 @@ def checkApachedexResult(apachedex_path, apachedex_report_status_file, desired_t
with open(apachedex_report_status_file) as f:
try:
json_content = json.load(f)
except ValueError as e:
except ValueError:
json_content = ''
if json_content:
message += "\n" + json_content["message"]
......
......@@ -60,7 +60,7 @@ def checkMariadbDigestResult(mariadbdex_path, mariadbdex_report_status_file,
with open(mariadbdex_report_status_file) as f:
try:
json_content = json.load(f)
except ValueError as e:
except ValueError:
json_content = ''
if json_content:
message += "\n" + json_content["message"]
......
......@@ -90,7 +90,6 @@ def checkWebpageHttpCacheHit(url_list, resolve_list=[], cookie_jar_path=None):
raise
response_headers.seek(0)
status = response_headers.readline().split(" ")[1]
m = Message(response_headers)
......
......@@ -157,7 +157,6 @@ class RunPromise(GenericPromise):
if disk_size is not None:
default_threshold = round(disk_size/(1024*1024*1024) * 0.05, 2)
threshold = float(self.getConfig('threshold', default_threshold) or 2.0)
threshold_days = float(self.getConfig('threshold-days', '30'))
free_space = self.getFreeSpace(disk_partition, db_path, currentdate,
currenttime)
......
......@@ -71,7 +71,6 @@ class RunPromise(GenericPromise):
return
timetuple = email.utils.parsedate(bot_status['date'])
last_bot_datetime = datetime.datetime.fromtimestamp(time.mktime(timetuple))
last_bot_datetime_string = email.utils.formatdate(time.mktime(timetuple))
delta = self.utcnow - last_bot_datetime
# sanity check
if delta < datetime.timedelta(minutes=0):
......
......@@ -625,7 +625,6 @@ class QemuQMPWrapper(object):
print("Done.")
def updateDevice(self, option_dict):
argument_dict = {}
if 'device' in option_dict:
if option_dict['device'] == 'cpu':
return self._updateCPU(
......
......@@ -155,7 +155,6 @@ class ResiliencyTestSuite(object):
root_partition_parameter_dict = self._getPartitionParameterDict()
takeover_url = root_partition_parameter_dict['takeover-%s-%s-url' % (self.namebase, clone)]
takeover_password = root_partition_parameter_dict['takeover-%s-%s-password' % (self.namebase, clone)]
# Connect to takeover web interface and wait for importer script to be not running
takeover_page_content = urlopen(takeover_url).read()
......
......@@ -143,7 +143,7 @@ def serve(config):
app.config.update(default_repository_path=repository_path)
if len(os.listdir(workdir)) == 0 or not os.path.exists(repository_path):
app.logger.info('cloning repository %s...' % repo_url)
result = cloneRepo(repo_url, repository_path)
cloneRepo(repo_url, repository_path)
if branch_name:
switchBranch(repository_path, branch_name)
except GitCommandError as e:
......
......@@ -20,7 +20,6 @@ class Options:
class TestEqueue(unittest.TestCase):
def setUp(self):
cwd = os.getcwd()
(
self.database,
self.takeover_triggered_file_path,
......
......@@ -183,7 +183,7 @@ class TestRunnerBackEnd(unittest.TestCase):
# If slapos is not running, process should be stopped and directories emptied
mock_isInstanceRunning.return_value = False
result = runner_utils.removeCurrentInstance(config)
runner_utils.removeCurrentInstance(config)
self.assertTrue(mock_svcStopAll.called)
self.sup_process.stopProcess.assert_called_with(config, 'slapproxy')
......
......@@ -85,9 +85,8 @@ class TestSecureDelete(unittest.TestCase):
def test_secure_remove_file_check_exist_false(self):
options = getAgumentParser().parse_args(['-n', '2', '-u', '--file', 'random.txt'])
passes = 2
with self.assertRaises(RuntimeError):
result = shred(options)
shred(options)
def test_secure_remove_file_with_link(self):
options = getAgumentParser().parse_args(['-n', '2', '-u', '--file', self.link_name])
......
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