Bug #16631

Validators do not use default values in hammer

Added by Martin Bacovsky 10 months ago. Updated 4 months ago.

Status:Closed
Priority:Normal
Assigned To:Martin Bacovsky
Category:Hammer core
Target version:Foreman - Team Ivan Iteration 12
Difficulty: Bugzilla link:1369609
Found in release: Pull request:https://github.com/theforeman/hammer-cli/pull/217
Story points-
Velocity based estimate-
Releasehammer-cli-0.9.0Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1369609

Description of problem:

When creating the content view filter using hammer, it does not read the default organization and location from the defaults.yml file.

Version-Release number of selected component (if applicable):
Satellite 6.2

How reproducible:
100%

Steps to Reproduce:

1.Set default organization and location by creating defaults.yml and copy it in /root/.hammer
~~
hammer> organization list
---|------|--------------------------------------|------------
ID | NAME | LABEL | DESCRIPTION
---|------|--------------------------------------|------------
1 | org1 | 1e9d14ee-f38d-46cb-a7b7-63f4d39a20b6 |
---|------|--------------------------------------|------------
hammer> location list
---|-----
ID | NAME
---|-----
2 | loc1
---|-----
hammer>

[root@sat62 hammer_cli]# cat /root/.hammer/defaults.yml
---
:defaults:
:organization_id:
:value: '1'
:location_id:
:value: '2'
~~

2. login to hammer shell
3. Try hammer commands which use organization and location:

Other hammer commands working as below:

~~~
  1. hammer> repository list
    ---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------
    ID | NAME | PRODUCT | CONTENT TYPE | URL
    ---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------
    2 | Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64 | Red Hat Enterprise Linux Server | yum | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-tools/6....
    1 | Red Hat Enterprise Linux 7 Server RPMs x86_64 7.2 | Red Hat Enterprise Linux Server | yum | https://cdn.redhat.com/content/dist/rhel/server/7/7.2/x86_64/os
    3 | Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.2 | Red Hat Enterprise Linux Server | yum | https://cdn.redhat.com/content/dist/rhel/server/7/7.2/x86_64/kickstart
    ---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------

hammer> content-view list
----------------|---------------------------|---------------------------|-----------|---------------
CONTENT VIEW ID | NAME | LABEL | COMPOSITE | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------
1 | Default Organization View | Default_Organization_View | |
2 | cv_rhel7 | cv_rhel7 | | 1, 2, 3
----------------|---------------------------|---------------------------|-----------|---------------
~~~

Actual results:

But when we try to create content view filter, it fails with organization id.

~~~
hammer> content-view filter create --name "July" --type erratum --inclusion true --content-view cv_rhel7
Could not create the filter:
Error: At least one of options --organization-id, --organization, --organization-label is required

See: ' content-view filter create --help'
~~~

Expected results:
It should work using the default value like other hammer commands.

Additional info:
N/A

Associated revisions

Revision 0b661324
Added by Martin Bacovsky 10 months ago

Fixes #16631 - Use defaults in validators

History

#1 Updated by Martin Bacovsky 10 months ago

  • Subject changed from content view filter does not use 'Default' organization and location in hammer to Validators do not use default values in hammer
  • Category set to Hammer core
  • Status changed from New to Assigned
  • Assigned To set to Martin Bacovsky
  • Target version set to Team Ivan Iteration 3

#2 Updated by The Foreman Bot 10 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/217 added

#3 Updated by Ivan Necas 10 months ago

  • Target version changed from Team Ivan Iteration 3 to Team Ivan Iteration 4

#4 Updated by Martin Bacovsky 10 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Tomáš Strachota 4 months ago

  • Release set to hammer-cli-0.9.0

#6 Updated by Ivan Necas 4 months ago

  • Target version changed from Team Ivan Iteration 4 to Team Ivan Iteration 12

Also available in: Atom PDF