Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JMESPath filtering feature #2

Merged
merged 1 commit into from
Feb 15, 2021
Merged

Add JMESPath filtering feature #2

merged 1 commit into from
Feb 15, 2021

Conversation

fridim
Copy link
Contributor

@fridim fridim commented Feb 9, 2021

This change, if applied, adds a new argument to the agnosticv CLI:

--has STRING

That option allows the user to filter the output of --list by
specifying a JSMEPath expression. The expression is applied on the
result of the merge for each catalog item and the catalog item is
included if the expression matches (result is not null and not false).

That feature will be used later in agnosticv-operator.

Examples:

$ agnosticv --list --has "master_instance_type == 'c5d.xlarge'"
gpte/OCP4_GETTING_STARTED_WORKSHOP/dev.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/prod.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/test.yaml
gpte/OCP4_WORKSHOP_PIPELINES/dev.yaml
gpte/OCP4_WORKSHOP_PIPELINES/prod.yaml
$ agnosticv --list --has "env_type == 'ocp4-cluster'" |wc -l
189
$ grep ocp4-cluster * -r|wc -l
78   # NOT the same because env_type is usually defined in common.yml

This change, if applied, adds a new argument to the agnosticv CLI:

```
--has STRING
```

That option allows the user to filter the output of `--list` by
specifying a JSMEPath expression. The expression is applied on the
result of the merge for each catalog item and the catalog item is
included if the expression matches (result is not null and not false).

That feature will be used later in agnosticv-operator.

Examples:

```
$ agnosticv --list --has "master_instance_type == 'c5d.xlarge'"
gpte/OCP4_GETTING_STARTED_WORKSHOP/dev.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/prod.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/test.yaml
gpte/OCP4_WORKSHOP_PIPELINES/dev.yaml
gpte/OCP4_WORKSHOP_PIPELINES/prod.yaml
```

```
$ agnosticv --list --has "env_type == 'ocp4-cluster'" |wc -l
189
$ grep ocp4-cluster * -r|wc -l
78   # NOT the same because env_type is usually defined in common.yml
```
@fridim fridim requested a review from jkupferer February 9, 2021 23:11
@fridim fridim merged commit ab7b764 into master Feb 15, 2021
fridim added a commit that referenced this pull request Feb 16, 2021
This change, if applied, adds a new argument to the agnosticv CLI:

```
--has STRING
```

That option allows the user to filter the output of `--list` by
specifying a JSMEPath expression. The expression is applied on the
result of the merge for each catalog item and the catalog item is
included if the expression matches (result is not null and not false).

That feature will be used later in agnosticv-operator.

Examples:

```
$ agnosticv --list --has "master_instance_type == 'c5d.xlarge'"
gpte/OCP4_GETTING_STARTED_WORKSHOP/dev.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/prod.yaml
gpte/OCP4_GETTING_STARTED_WORKSHOP/test.yaml
gpte/OCP4_WORKSHOP_PIPELINES/dev.yaml
gpte/OCP4_WORKSHOP_PIPELINES/prod.yaml
```

```
$ agnosticv --list --has "env_type == 'ocp4-cluster'" |wc -l
189
$ grep ocp4-cluster * -r|wc -l
78   # NOT the same because env_type is usually defined in common.yml
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants