Skip to content

Commit b60f676

Browse files
authored
Merge pull request #194 from britive/develop
v2.1.0
2 parents 288118f + 2f011bd commit b60f676

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
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.0 [2025-03-10]
7+
8+
__What's New:__
9+
10+
* `pybritive-aws-cred-process` can now prompt users for `otp` or `justification` when needed.
11+
* `my_resource` profile checkouts can now specify a `response_template` by appending `/{template name}` to the profile.
12+
* Added "Global Settings" section to docs site.
13+
14+
__Enhancements:__
15+
16+
* Added ITSM `--ticket-type` `--ticket-id` options.
17+
* Additional `global` config settings: `my_[access|resources]_retrieval_limit` to limit size of retrieved items.
18+
19+
__Bug Fixes:__
20+
21+
* Fixed missing `exceptions.StepUpAuthRequiredButNotProvided` catch during `checkout`.
22+
23+
__Dependencies:__
24+
25+
* `britive>=4.1.2,<5.0`
26+
* `colored>=2.2.5`
27+
28+
__Other:__
29+
30+
* Python 3.8 is EOL, so support is dropped.
31+
* Allow `_` uniformity for `auto_refresh_[kube_config|profile_cache]` in `global` config.
32+
* Tests and Documentation updates for SDK alignment.
33+
634
## v2.1.0-rc.7 [2025-03-10]
735

836
__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-rc.7'
1+
__version__ = '2.1.0'

src/pybritive/britive_cli.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def debug(self, data: object, ignore_silent: bool = False):
243243
if debug_enabled:
244244
self.print(data=data, ignore_silent=ignore_silent)
245245

246-
# will be passed to the britive checkout_by_name progress_func parameter when appropriate
246+
# will be passed to the britive checkout progress_func parameter when appropriate
247247
def checkout_callback_printer(self, message: str):
248248
if self.silent or not sys.stdout.isatty():
249249
return
@@ -474,8 +474,7 @@ def _set_available_profiles(self, from_cache_command=False, profile_type: Option
474474
envs = {e['environmentId']: e for e in access_data.get('environments', [])}
475475
profiles = {p['papId']: p for p in access_data.get('profiles', [])}
476476
accesses = [
477-
tuple([a['appContainerId'], a['environmentId'], a['papId']])
478-
for a in access_data.get('accesses', [])
477+
([a['appContainerId'], a['environmentId'], a['papId']]) for a in access_data.get('accesses', [])
479478
]
480479
access_output = []
481480
for app_id, env_id, profile_id in accesses:
@@ -572,6 +571,14 @@ def _get_app_type(self, application_id):
572571
for profile in self.available_profiles:
573572
if profile['app_id'] == application_id:
574573
return profile['app_type']
574+
if self.config.my_access_retrieval_limit:
575+
return next(
576+
iter(
577+
a['catalogAppName']
578+
for a in self.b.get(f'{self.b.base_url}/access/apps/')
579+
if a['appContainerId'] == application_id
580+
)
581+
)
575582
raise click.ClickException(f'Application {application_id} not found')
576583

577584
def __get_cloud_credential_printer(
@@ -1242,6 +1249,34 @@ def _convert_names_to_ids(self, profile_name: str, environment_name: str, applic
12421249

12431250
# let's first check to ensure we have only 1 profile
12441251
if len(found_profiles) == 0:
1252+
if self.config.my_access_retrieval_limit:
1253+
try:
1254+
app_id = next(
1255+
iter(
1256+
a['appContainerId']
1257+
for a in self.b.get(f'{self.b.base_url}/access/apps/')
1258+
if a['catalogAppDisplayName'].lower() == application_name
1259+
)
1260+
)
1261+
env_id = next(
1262+
iter(
1263+
e['environmentId']
1264+
for e in self.b.get(f'{self.b.base_url}/access/apps/{app_id}/environments/')
1265+
if e['environmentName'].lower() == environment_name
1266+
or e['environmentId'] == environment_name
1267+
or e['alternateEnvironmentName'].lower() == environment_name
1268+
)
1269+
)
1270+
pap_id = next(
1271+
iter(
1272+
p['papId']
1273+
for p in self.b.get(f'{self.b.base_url}/access/apps/{app_id}/environments/{env_id}/paps')
1274+
if p['papName'].lower() == profile_name
1275+
)
1276+
)
1277+
return {'profile_id': pap_id, 'environment_id': env_id}
1278+
except StopIteration:
1279+
pass
12451280
raise click.ClickException('no profile found with the provided application, environment, and profile names')
12461281
if len(found_profiles) > 1:
12471282
raise click.ClickException('multiple matching profiles found - cannot determine which profile to use')

0 commit comments

Comments
 (0)