Skip to content

Commit

Permalink
fix(project): fixes project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv-mohith authored and ankitrgadiya committed Dec 9, 2022
1 parent e140c4c commit e89a1b4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions riocli/project/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def get_project_name(client: Client, guid: str) -> str:
project = client.get_project(guid)
return project.name


def find_organization_guid(client: Client, name: str) -> str:
organizations = client.get_user_organizations()
options = {}
Expand All @@ -80,7 +81,6 @@ def find_organization_guid(client: Client, name: str) -> str:
return choice



def get_organization_name(client: Client, guid: str) -> str:
organizations = client.get_user_organizations()
for organization in organizations:
Expand All @@ -89,13 +89,14 @@ def get_organization_name(client: Client, guid: str) -> str:

raise OrganizationNotFound("User is not part of organization with guid: {}".format(guid))


def name_to_organization_guid(f: typing.Callable) -> typing.Callable:
@functools.wraps(f)
def decorated(**kwargs: typing.Any):
client = new_client(with_project=False)
name = kwargs.get('organization_name') or kwargs.pop('organization')
name = kwargs.get('organization_name')
guid = None

if name:
try:
if name.startswith('org-'):
Expand All @@ -107,7 +108,7 @@ def decorated(**kwargs: typing.Any):
click.secho(str(e), fg='red')
raise SystemExit(1)
kwargs['organization_name'] = name
kwargs['organization_guid'] = guid
kwargs['organization_guid'] = guid
f(**kwargs)

return decorated
Expand All @@ -118,7 +119,8 @@ def __init__(self, message='project not found'):
self.message = message
super().__init__(self.message)


class OrganizationNotFound(Exception):
def __init__(self, message='organization not found'):
self.message = message
super().__init__(self.message)
super().__init__(self.message)

0 comments on commit e89a1b4

Please sign in to comment.