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
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@
> 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.0 [2025-03-10]

__What's New:__

* `pybritive-aws-cred-process` can now prompt users for `otp` or `justification` when needed.
* `my_resource` profile checkouts can now specify a `response_template` by appending `/{template name}` to the profile.
* Added "Global Settings" section to docs site.

__Enhancements:__

* Added ITSM `--ticket-type` `--ticket-id` options.
* Additional `global` config settings: `my_[access|resources]_retrieval_limit` to limit size of retrieved items.

__Bug Fixes:__

* Fixed missing `exceptions.StepUpAuthRequiredButNotProvided` catch during `checkout`.

__Dependencies:__

* `britive>=4.1.2,<5.0`
* `colored>=2.2.5`

__Other:__

* Python 3.8 is EOL, so support is dropped.
* Allow `_` uniformity for `auto_refresh_[kube_config|profile_cache]` in `global` config.
* Tests and Documentation updates for SDK alignment.

## v2.1.0-rc.7 [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-rc.7'
__version__ = '2.1.0'
41 changes: 38 additions & 3 deletions src/pybritive/britive_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def debug(self, data: object, ignore_silent: bool = False):
if debug_enabled:
self.print(data=data, ignore_silent=ignore_silent)

# will be passed to the britive checkout_by_name progress_func parameter when appropriate
# will be passed to the britive checkout progress_func parameter when appropriate
def checkout_callback_printer(self, message: str):
if self.silent or not sys.stdout.isatty():
return
Expand Down Expand Up @@ -474,8 +474,7 @@ def _set_available_profiles(self, from_cache_command=False, profile_type: Option
envs = {e['environmentId']: e for e in access_data.get('environments', [])}
profiles = {p['papId']: p for p in access_data.get('profiles', [])}
accesses = [
tuple([a['appContainerId'], a['environmentId'], a['papId']])
for a in access_data.get('accesses', [])
([a['appContainerId'], a['environmentId'], a['papId']]) for a in access_data.get('accesses', [])
]
access_output = []
for app_id, env_id, profile_id in accesses:
Expand Down Expand Up @@ -572,6 +571,14 @@ def _get_app_type(self, application_id):
for profile in self.available_profiles:
if profile['app_id'] == application_id:
return profile['app_type']
if self.config.my_access_retrieval_limit:
return next(
iter(
a['catalogAppName']
for a in self.b.get(f'{self.b.base_url}/access/apps/')
if a['appContainerId'] == application_id
)
)
raise click.ClickException(f'Application {application_id} not found')

def __get_cloud_credential_printer(
Expand Down Expand Up @@ -1242,6 +1249,34 @@ def _convert_names_to_ids(self, profile_name: str, environment_name: str, applic

# let's first check to ensure we have only 1 profile
if len(found_profiles) == 0:
if self.config.my_access_retrieval_limit:
try:
app_id = next(
iter(
a['appContainerId']
for a in self.b.get(f'{self.b.base_url}/access/apps/')
if a['catalogAppDisplayName'].lower() == application_name
)
)
env_id = next(
iter(
e['environmentId']
for e in self.b.get(f'{self.b.base_url}/access/apps/{app_id}/environments/')
if e['environmentName'].lower() == environment_name
or e['environmentId'] == environment_name
or e['alternateEnvironmentName'].lower() == environment_name
)
)
pap_id = next(
iter(
p['papId']
for p in self.b.get(f'{self.b.base_url}/access/apps/{app_id}/environments/{env_id}/paps')
if p['papName'].lower() == profile_name
)
)
return {'profile_id': pap_id, 'environment_id': env_id}
except StopIteration:
pass
raise click.ClickException('no profile found with the provided application, environment, and profile names')
if len(found_profiles) > 1:
raise click.ClickException('multiple matching profiles found - cannot determine which profile to use')
Expand Down