Skip to content

Commit 7f4fe97

Browse files
fix(project): fixes the list and inspect project functionality when no organization is selected
1 parent 15719f0 commit 7f4fe97

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

riocli/project/list.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from munch import unmunchify
2020

2121
from riocli.config import new_v2_client
22-
from riocli.constants import Colors, Symbols
22+
from riocli.constants import Colors
2323
from riocli.organization.util import name_to_guid as name_to_organization_guid
2424
from riocli.utils import tabulate_data
2525

@@ -74,13 +74,6 @@ def list_projects(
7474
"""
7575
# If organization is not passed in the options, use
7676
organization_guid = organization_guid or ctx.obj.data.get("organization_id")
77-
if organization_guid is None:
78-
err_msg = (
79-
"Organization not selected. Please set an organization with "
80-
"`rio organization select ORGANIZATION_NAME` or pass the --organization option."
81-
)
82-
click.secho("{} {}".format(Symbols.ERROR, err_msg), fg=Colors.RED)
83-
raise SystemExit(1)
8477

8578
query = {"labelSelector": labels}
8679

riocli/v2client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def list_projects(
7171
query: Optional[dict] = None,
7272
) -> Munch:
7373
"""
74-
List all projects in an organization
74+
List all projects in an organization or where user have the access to in all organizations.
7575
"""
7676

7777
url = "{}/v2/projects/".format(self._host)
78-
headers = self._get_auth_header(with_project=False)
78+
headers = self._get_auth_header(with_project=False, with_organization=False)
7979

8080
params = {}
8181

@@ -96,7 +96,7 @@ def get_project(self, project_guid: str) -> Munch:
9696
Get a project by its GUID
9797
"""
9898
url = "{}/v2/projects/{}/".format(self._host, project_guid)
99-
headers = self._get_auth_header()
99+
headers = self._get_auth_header(with_organization=False)
100100
response = RestClient(url).method(HttpMethod.GET).headers(headers).execute()
101101

102102
handle_server_errors(response)

0 commit comments

Comments
 (0)