Skip to content

Commit 2d57ee8

Browse files
authored
Merge pull request #196 from britive/develop
v2.1.1
2 parents b60f676 + 4f3d269 commit 2d57ee8

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@
33
> As of v1.4.0, release candidates will be published in an effort to get new features out faster while still allowing
44
> time for full QA testing before moving the release candidate to a full release.
55
6+
## v2.1.1 [2025-03-13]
7+
8+
__What's New:__
9+
10+
* None
11+
12+
__Enhancements:__
13+
14+
* None
15+
16+
__Bug Fixes:__
17+
18+
* Skip `construct_kube_config` if `env_properties` is missing.
19+
* Retrieve `profileEnvironmentProperties` from `my_access.list_profiles` if the new API doesn't return the data.
20+
21+
__Dependencies:__
22+
23+
* None
24+
25+
__Other:__
26+
27+
* None
28+
629
## v2.1.0 [2025-03-10]
730

831
__What's New:__

src/pybritive/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.1.0'
1+
__version__ = '2.1.1'

src/pybritive/britive_cli.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,32 @@ def list_environments(self):
460460
data.append(row)
461461
self.print(data, ignore_silent=True)
462462

463+
# temporary fix till the new API is updated to return `profileEnvironmentProperties`
464+
def _get_missing_env_properties(
465+
self, app_id: str, app_type: str, env_id: str, profile_id: str, from_cache_command: bool
466+
) -> dict:
467+
if app_type.lower() == 'kubernetes' and (from_cache_command or self.config.auto_refresh_kube_config()):
468+
if not self.listed_profiles:
469+
self.listed_profiles = self.b.my_access.list_profiles()
470+
return next(
471+
(
472+
env['profileEnvironmentProperties']
473+
for app in self.listed_profiles
474+
if app['appContainerId'] == app_id
475+
for profile in app.get('profiles', [])
476+
if profile['profileId'] == profile_id
477+
for env in profile.get('environments', [])
478+
if env['environmentId'] == env_id
479+
),
480+
{},
481+
)
482+
return {}
483+
463484
def _set_available_profiles(self, from_cache_command=False, profile_type: Optional[str] = None):
464485
if not self.available_profiles:
465486
data = []
466487
if not profile_type or profile_type == 'my-access':
488+
self.listed_profiles = None
467489
access_limit = int(self.config.my_access_retrieval_limit)
468490
increase = 0
469491
while (access_data := self.b.my_access.list(size=access_limit + increase))['count'] > len(
@@ -496,7 +518,10 @@ def _set_available_profiles(self, from_cache_command=False, profile_type: Option
496518
'profile_allows_programmatic': app.get('programmaticAccess', False),
497519
'profile_description': profile['papDescription'],
498520
'2_part_profile_format_allowed': app['supportsMultipleProfilesCheckoutConsole'],
499-
'env_properties': env.get('profileEnvironmentProperties', {}),
521+
'env_properties': env['profileEnvironmentProperties']
522+
or self._get_missing_env_properties(
523+
app_id, app['catalogAppName'], env_id, profile_id, from_cache_command
524+
),
500525
}
501526
if row not in access_output:
502527
access_output.append(row)
@@ -542,7 +567,7 @@ def construct_kube_config(self, from_cache_command=False):
542567

543568
profiles = []
544569
for p in self.available_profiles:
545-
if p['app_type'].lower() == 'kubernetes':
570+
if p['app_type'].lower() == 'kubernetes' and p['env_properties']:
546571
props = p['env_properties']
547572
url = props.get('apiServerUrl')
548573
cert = props.get('certificateAuthorityData')

0 commit comments

Comments
 (0)