Skip to content

Commit

Permalink
Merge pull request eclipse-volttron#120 from craig8/115_auth_file_imp…
Browse files Browse the repository at this point in the history
…orts

Fixed auth errors
  • Loading branch information
shwethanidd authored Nov 23, 2022
2 parents 06f6354 + 29b810f commit 92cd98d
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/volttron/client/commands/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,7 +60,6 @@
from typing import List
from datetime import timedelta, datetime


# TODO Requests dependency
# import requests
# from requests.exceptions import ConnectionError
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ""

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 92cd98d

Please sign in to comment.