Skip to content

Commit 5821185

Browse files
authored
Merge pull request #48 from synkd/accept_token_as_arg_for_cli_delete
Accept offline token option for CLI delete command
2 parents b53f403 + 7e0ff17 commit 5821185

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

manifester/commands.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ def get_manifest(manifest_category, allocation_name, requester):
5151
default=False,
5252
help="Delete local manifest files in addition to upstream subscription allocations",
5353
)
54-
def delete(allocations, all_, remove_manifest_file):
54+
@click.option("--offline-token", type=str, default=None)
55+
def delete(allocations, all_, remove_manifest_file, offline_token):
5556
"""Delete subscription allocations in inventory and optionally delete local manifest files."""
5657
inv = helpers.load_inventory_file(Path(settings.inventory_path))
5758
for num, allocation in enumerate(inv):
5859
if str(num) in allocations or allocation.get("name") in allocations or all_:
59-
Manifester(minimal_init=True).delete_subscription_allocation(
60-
uuid=allocation.get("uuid")
61-
)
60+
Manifester(
61+
minimal_init=True, offline_token=offline_token
62+
).delete_subscription_allocation(uuid=allocation.get("uuid"))
6263
if remove_manifest_file:
6364
manifester_directory = (
6465
Path(os.environ["MANIFESTER_DIRECTORY"]).resolve()
@@ -78,7 +79,9 @@ def inventory(details, sync, offline_token):
7879
"""Display the local inventory file's contents."""
7980
border = "-" * 38
8081
if sync:
81-
helpers.update_inventory(Manifester(minimal_init=True, offline_token=offline_token).subscription_allocations)
82+
helpers.update_inventory(
83+
Manifester(minimal_init=True, offline_token=offline_token).subscription_allocations
84+
)
8285
inv = helpers.load_inventory_file(Path(settings.inventory_path))
8386
if not details:
8487
logger.info("Displaying local inventory data")

0 commit comments

Comments
 (0)