Skip to content

Commit

Permalink
Merge pull request #8 from synkd/refactor_manifester_settings
Browse files Browse the repository at this point in the history
Refactor settings and reformat multiple files
  • Loading branch information
synkd authored Aug 1, 2022
2 parents a79c10a + e75e84a commit e5e4a90
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 57 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ pip install .
```
# Configuration

The `manifester_settings.yaml` file is used to configure manifester via [DynaConf](https://github.com/rochacbruno/dynaconf/).
The `manifester_settings.yaml` file is used to configure manifester via [DynaConf](https://github.com/rochacbruno/dynaconf/).

Multiple types of manifests can be configured in the `manifest_category` section of `manifester_settings.yaml`. These types can be differentiated based on the Satellite version of the subscription allocation, the names and quantities of the subscriptions to be added to the manifest, and whether [Simple Content Access](https://access.redhat.com/documentation/en-us/subscription_central/2021/html-single/getting_started_with_simple_content_access/index) is enabled on the manifest.
Multiple types of manifests can be configured in the `manifest_category` section of `manifester_settings.yaml`. These types can be differentiated based on the Satellite version of the subscription allocation, the names and quantities of the subscriptions to be added to the manifest, and whether [Simple Content Access](https://access.redhat.com/documentation/en-us/subscription_central/2021/html-single/getting_started_with_simple_content_access/index) is enabled on the manifest.

The value of the `name` setting for each subscription in a manifest must exactly match the name of a subscription available in the account which was used to generate the offline token. One method for determining the subscription names available in an account is to register a system to RHSM and then run `subscription manager list --available` on that system. A planned future feature of Manifester is a CLI command that will return a list of available subscriptions.

Expand All @@ -32,4 +32,4 @@ Currently, the only action supported by the manifester CLI is generating a manif
```
manifester get-manifest --manifest-category <manifest category name> --allocation_name <allocation name>
```
Two options are available for this subcommand. The `--manifest_category` option is required and must match one of the manifest categories defined in `manifester_settings.yaml`. The `--allocation_name` option specifies the name of the subscription allocation in RHSM and is also used in the file name of the manifest archive exported by Manifester. If no value is supplied for `--allocation_name`, a string of 10 random alphabetic characters will be used for the allocation name.
Two options are available for this subcommand. The `--manifest_category` option is required and must match one of the manifest categories defined in `manifester_settings.yaml`. The `--allocation_name` option specifies the name of the subscription allocation in RHSM and is also used in the file name of the manifest archive exported by Manifester. If no value is supplied for `--allocation_name`, a string of 10 random alphabetic characters will be used for the allocation name.
13 changes: 9 additions & 4 deletions manifester/commands.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import click

from manifester import logger as mlog
from manifester.settings import settings
from manifester import Manifester


# To do: add a command for returning subscription pools
@click.group
def cli():
pass


@cli.command()
@click.option("--manifest_category", type=str, help="Category of manifest (golden_ticket or robottelo_automation by default)")
@click.option("--allocation_name", type=str, help="Name of upstream subscription allocation")
@click.option(
"--manifest_category",
type=str,
help="Category of manifest (golden_ticket or robottelo_automation by default)",
)
@click.option(
"--allocation_name", type=str, help="Name of upstream subscription allocation"
)
def get_manifest(manifest_category, allocation_name):
manifester = Manifester(manifest_category, allocation_name)
manifester.create_subscription_allocation()
Expand Down
2 changes: 1 addition & 1 deletion manifester/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def simple_retry(cmd, cmd_args=None, cmd_kwargs=None, max_timeout=240, _cur_time
cmd_kwargs = cmd_kwargs if cmd_kwargs else {}
# If additional debug information is needed, the following log entry can be modified to
# include the data being passed by adding {cmd_kwargs=} to the f-string. Please do so
# with caution as some data (notably the offline token) should be treated as a secret.
# with caution as some data (notably the offline token) should be treated as a secret.
logger.debug(f"Sending request to endpoint {cmd_args}")
response = cmd(*cmd_args, **cmd_kwargs)
logger.debug(f"Response status code is {response.status_code}")
Expand Down
Loading

0 comments on commit e5e4a90

Please sign in to comment.