Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
> As of v1.4.0, release candidates will be published in an effort to get new features out faster while still allowing
> time for full QA testing before moving the release candidate to a full release.

## v2.1.1 [2025-03-13]

__What's New:__

* None

__Enhancements:__

* None

__Bug Fixes:__

* Skip `construct_kube_config` if `env_properties` is missing.
* Retrieve `profileEnvironmentProperties` from `my_access.list_profiles` if the new API doesn't return the data.

__Dependencies:__

* None

__Other:__

* None

## v2.1.0 [2025-03-10]

__What's New:__
Expand Down
2 changes: 1 addition & 1 deletion src/pybritive/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.0'
__version__ = '2.1.1'
29 changes: 27 additions & 2 deletions src/pybritive/britive_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,32 @@ def list_environments(self):
data.append(row)
self.print(data, ignore_silent=True)

# temporary fix till the new API is updated to return `profileEnvironmentProperties`
def _get_missing_env_properties(
self, app_id: str, app_type: str, env_id: str, profile_id: str, from_cache_command: bool
) -> dict:
if app_type.lower() == 'kubernetes' and (from_cache_command or self.config.auto_refresh_kube_config()):
if not self.listed_profiles:
self.listed_profiles = self.b.my_access.list_profiles()
return next(
(
env['profileEnvironmentProperties']
for app in self.listed_profiles
if app['appContainerId'] == app_id
for profile in app.get('profiles', [])
if profile['profileId'] == profile_id
for env in profile.get('environments', [])
if env['environmentId'] == env_id
),
{},
)
return {}

def _set_available_profiles(self, from_cache_command=False, profile_type: Optional[str] = None):
if not self.available_profiles:
data = []
if not profile_type or profile_type == 'my-access':
self.listed_profiles = None
access_limit = int(self.config.my_access_retrieval_limit)
increase = 0
while (access_data := self.b.my_access.list(size=access_limit + increase))['count'] > len(
Expand Down Expand Up @@ -496,7 +518,10 @@ def _set_available_profiles(self, from_cache_command=False, profile_type: Option
'profile_allows_programmatic': app.get('programmaticAccess', False),
'profile_description': profile['papDescription'],
'2_part_profile_format_allowed': app['supportsMultipleProfilesCheckoutConsole'],
'env_properties': env.get('profileEnvironmentProperties', {}),
'env_properties': env['profileEnvironmentProperties']
or self._get_missing_env_properties(
app_id, app['catalogAppName'], env_id, profile_id, from_cache_command
),
}
if row not in access_output:
access_output.append(row)
Expand Down Expand Up @@ -542,7 +567,7 @@ def construct_kube_config(self, from_cache_command=False):

profiles = []
for p in self.available_profiles:
if p['app_type'].lower() == 'kubernetes':
if p['app_type'].lower() == 'kubernetes' and p['env_properties']:
props = p['env_properties']
url = props.get('apiServerUrl')
cert = props.get('certificateAuthorityData')
Expand Down