Skip to content

Commit dce3bb2

Browse files
committed
fixes involving variable types and handling exceptions in agentctl
1 parent bf84dab commit dce3bb2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

psconfig/perfsonar-psconfig/bin/commands/agentctl

+7-3
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,13 @@ elif len(args.values) > 0:
259259
cli.print_msg("Successfully set {} in {}".format(args.prop, config_file))
260260
elif args.unset:
261261
#unset an option
262-
del agent_conf.data[args.prop]
263-
_save_and_validate(agent_conf, config_client, cli)
264-
cli.print_msg("Successfully unset {} in {}".format(args.prop, config_file))
262+
try:
263+
del agent_conf.data[args.prop]
264+
_save_and_validate(agent_conf, config_client, cli)
265+
cli.print_msg("Successfully unset {} in {}".format(args.prop, config_file))
266+
except KeyError:
267+
cli.print_msg("{} was not set in {}. No action performed".format(args.prop, config_file))
268+
265269
else:
266270
# print current value of property
267271
_print_prop(args.prop, agent_conf.data.get(args.prop, None), cli)

psconfig/perfsonar-psconfig/psconfig/base_agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def run(self):
146146
check_interval = None
147147

148148
try:
149-
check_interval = duration_to_seconds(agent_conf.check_interval())
149+
check_interval = int(duration_to_seconds(agent_conf.check_interval()))
150150
except Exception as e:
151151
self.logger.error(self.logf.format("Error parsing check-interval. Defaulting to " + str(self.check_interval_seconds) + " seconds: {}".format(e)))
152152
pass

0 commit comments

Comments
 (0)