-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/SK-1229 | Project resource for CLI extension #784
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mycket bra! Har några kommentarer
fedn/cli/login_cmd.py
Outdated
@click.option("-H", "--host", required=False, default="fedn.scaleoutsystems.com", help="Hostname of controller (api)") | ||
@click.option("-p", "--protocol", required=False, default=CONTROLLER_DEFAULTS["protocol"], help="Communication protocol of controller (api)") | ||
@click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") | ||
@click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skulle även vilja ha alternativet att kunna ange --user --password istället för promt
fedn/cli/login_cmd.py
Outdated
else: | ||
click.secho(f"Unexpected error: {response.text}", fg="red") | ||
|
||
|
||
def get_context(response, protocol, host, port): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add doc string explaning what the function do, and in particular explain what context_data is.
fedn/cli/login_cmd.py
Outdated
if not os.path.exists(context_path): | ||
os.makedirs(context_path) | ||
try: | ||
with open(f"{context_path}/context.yaml", "w") as yaml_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vad händer om det redan finns en context.yaml med innehåll?
fedn/cli/login_cmd.py
Outdated
headers_projects["Authorization"] = _token | ||
|
||
try: | ||
response_projects = requests.get(url_projects, headers=headers_projects) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
om det returnerar status_code != 200 vad händer då?
fedn/cli/login_cmd.py
Outdated
except requests.exceptions.ConnectionError: | ||
click.echo(f"Error: Could not connect to {url_project_token}") | ||
|
||
controller_url = f"{protocol}://{host}/{slug}-fedn-reducer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
istället för att hårdkoda url med "-fedn-reducer" bör den fullstädiga url till controller returneras av studio
fedn/cli/project_cmd.py
Outdated
def list_projects(ctx, protocol: str = None, host: str = None, port: str = None, token: str = None): | ||
"""Return: | ||
------ | ||
- result: list of packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list of packages?
fedn/cli/project_cmd.py
Outdated
for i in response_json: | ||
project_name = i.get("slug") | ||
if project_name == active_project: | ||
click.secho(project_name, fg="green") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skulle nog tom ha project_name + "(active)" för att vara ännu mer tydlig
fedn/cli/project_cmd.py
Outdated
@click.option("-p", "--protocol", required=False, default=CONTROLLER_DEFAULTS["protocol"], help="Communication protocol of controller (api)") | ||
@click.option("-H", "--host", required=False, default=CONTROLLER_DEFAULTS["host"], help="Hostname of controller (api)") | ||
@click.option("-P", "--port", required=False, default=CONTROLLER_DEFAULTS["port"], help="Port of controller (api)") | ||
@project_cmd.command("activate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm "activate", kanske "fedn project set-context"? Bara en tanke
fedn/cli/project_cmd.py
Outdated
context_data["Active project url"] = controller_url | ||
|
||
try: | ||
with open(f"{context_path}/context.yaml", "w") as yaml_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code redudancy, gör till utility metod
@@ -16,6 +18,8 @@ | |||
|
|||
API_VERSION = "v1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detta måste funka för windows också, gör det det?
Features: