Skip to content

Commit

Permalink
fixes involving variable types and handling exceptions in agentctl
Browse files Browse the repository at this point in the history
  • Loading branch information
sasgit-hub committed Sep 5, 2024
1 parent bf84dab commit dce3bb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions psconfig/perfsonar-psconfig/bin/commands/agentctl
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,13 @@ elif len(args.values) > 0:
cli.print_msg("Successfully set {} in {}".format(args.prop, config_file))
elif args.unset:
#unset an option
del agent_conf.data[args.prop]
_save_and_validate(agent_conf, config_client, cli)
cli.print_msg("Successfully unset {} in {}".format(args.prop, config_file))
try:
del agent_conf.data[args.prop]
_save_and_validate(agent_conf, config_client, cli)
cli.print_msg("Successfully unset {} in {}".format(args.prop, config_file))
except KeyError:
cli.print_msg("{} was not set in {}. No action performed".format(args.prop, config_file))

else:
# print current value of property
_print_prop(args.prop, agent_conf.data.get(args.prop, None), cli)
2 changes: 1 addition & 1 deletion psconfig/perfsonar-psconfig/psconfig/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def run(self):
check_interval = None

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

0 comments on commit dce3bb2

Please sign in to comment.