From 29b810fb45c9bf11370cb818c990b79d1e04b715 Mon Sep 17 00:00:00 2001 From: "C. Allwardt" <3979063+craig8@users.noreply.github.com> Date: Wed, 23 Nov 2022 14:14:25 -0800 Subject: [PATCH] Fixed auth errors --- src/volttron/client/commands/control.py | 50 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/volttron/client/commands/control.py b/src/volttron/client/commands/control.py index 6dd792a15..101d9c688 100644 --- a/src/volttron/client/commands/control.py +++ b/src/volttron/client/commands/control.py @@ -37,6 +37,10 @@ # }}} from gevent import monkey + +from volttron.services.auth import AuthFile +from volttron.services.auth.auth_service import AuthException, AuthEntry + monkey.patch_all() import gevent import gevent.event @@ -56,7 +60,6 @@ from typing import List from datetime import timedelta, datetime - # TODO Requests dependency # import requests # from requests.exceptions import ConnectionError @@ -190,7 +193,7 @@ def filter_agent(agents, pattern, opts): def backup_agent_data(output_filename, source_dir): with tarfile.open(output_filename, "w:gz") as tar: - tar.add(source_dir, arcname=os.path.sep) # os.path.basename(source_dir)) + tar.add(source_dir, arcname=os.path.sep) # os.path.basename(source_dir)) def restore_agent_data_from_tgz(source_file, output_dir): @@ -219,7 +222,7 @@ def tag_agent(opts): msg = "agent not found" _stderr.write("{}: error: {}: {}\n".format(opts.command, msg, opts.agent)) return 10 - (agent, ) = agents + (agent,) = agents if opts.tag: _stdout.write("Tagging {} {}\n".format(agent.uuid, agent.name)) opts.connection.call("tag_agent", agent.uuid, opts.tag) @@ -260,7 +263,6 @@ def _calc_min_uuid_length(agents): def list_agents(opts): - def get_priority(agent): return opts.aip.agent_priority(agent.uuid) or "" @@ -610,11 +612,11 @@ def status_agents(opts): agent = agents[uuid] agents[uuid] = agent._replace(agent_user=agent_user) except KeyError: - agents[uuid] = agent = Agent(name, - None, - uuid, - vip_identity=identity, - agent_user=agent_user) + agents[uuid] = agent = AgentMeta(name, + None, + uuid, + vip_identity=identity, + agent_user=agent_user) status[uuid] = stat agents = list(agents.values()) @@ -887,19 +889,18 @@ def list_auth(opts, indices=None): def _ask_for_auth_fields( - domain=None, - address=None, - user_id=None, - capabilities=None, - roles=None, - groups=None, - mechanism="CURVE", - credentials=None, - comments=None, - enabled=True, - **kwargs, + domain=None, + address=None, + user_id=None, + capabilities=None, + roles=None, + groups=None, + mechanism="CURVE", + credentials=None, + comments=None, + enabled=True, + **kwargs, ): - class Asker(object): def __init__(self): @@ -1432,7 +1433,6 @@ def _show_filtered_agents_status(opts, status_callback, health_callback, agents= def get_agent_publickey(opts): - def get_key(agent): return opts.aip.get_agent_keystore(agent.uuid).public @@ -2294,7 +2294,7 @@ def add_parser(*args, **kwargs) -> argparse.ArgumentParser: "pattern", nargs="*", help="Identity of agent, followed by method(s)" - "", + "", ) rpc_code.add_argument( "-v", @@ -2326,7 +2326,7 @@ def add_parser(*args, **kwargs) -> argparse.ArgumentParser: "--verbose", action="store_true", help="list all subsystem rpc methods in addition to the agent's rpc methods. If a method " - "is specified, display the doc-string associated with the method.", + "is specified, display the doc-string associated with the method.", ) rpc_list.set_defaults(func=list_agents_rpc, min_uuid_len=1) @@ -2707,7 +2707,7 @@ def add_parser(*args, **kwargs) -> argparse.ArgumentParser: dest="new_config", action="store_true", help="Ignore any existing configuration and creates new empty file." - " Configuration is not written if left empty. Type defaults to JSON.", + " Configuration is not written if left empty. Type defaults to JSON.", ) config_store_edit.set_defaults(func=edit_config, config_type="json")