Bug 1402134 - [RFE] Need Hammer CLI commands to do the HostGroup / Environments associations with Provisioning Template.
Summary: [RFE] Need Hammer CLI commands to do the HostGroup / Environments association...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Provisioning Templates
Version: 6.2.4
Hardware: All
OS: Linux
medium
medium vote
Target Milestone: Released
Assignee: Shira Maximov
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-06 21:01 UTC by Deepannagaraj Nagarathinam
Modified: 2019-10-07 17:17 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:36:19 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:36:28 UTC
Foreman Issue Tracker 3969 None None None 2016-12-14 14:33:10 UTC
Red Hat Knowledge Base (Solution) 2798481 None None None 2016-12-07 20:29:56 UTC

Comment 4 pm-sat@redhat.com 2018-07-24 12:28:44 UTC
Upstream bug assigned to mshira@redhat.com

Comment 5 pm-sat@redhat.com 2018-07-24 12:28:48 UTC
Upstream bug assigned to mshira@redhat.com

Comment 6 pm-sat@redhat.com 2018-08-20 16:14:58 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/3969 has been resolved.

Comment 8 Roman Plevka 2019-03-13 10:52:34 UTC
FAILED QA
sat6.5.0 snap 19

The parameter does not seem to be present.
Comparing the code with the commit i noticed, the filename is `combination.rb` instead of `combinations.rb`:

[root@sat-6-5-qa-rhel7 hammer_cli_foreman]# ls combin*
combination.rb
[root@sat-6-5-qa-rhel7 hammer_cli_foreman]# pwd
/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.15.1/lib/hammer_cli_foreman


[root@sat-6-5-qa-rhel7 ~]# rpm -qa | grep hammer
tfm-rubygem-hammer_cli-0.15.1.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_templates-0.1.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.6.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.1.0-2.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_discovery-1.0.0-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.13-1.el7sat.noarch
tfm-rubygem-hammer_cli_csv-2.3.1-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_ansible-0.1.1-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_virt_who_configure-0.0.3-3.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.16.0.10-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.15.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_admin-0.0.8-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3.3-5.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_openscap-0.1.6-2.el7sat.noarch
[root@sat-6-5-qa-rhel7 ~]# rpm -qa satellite
satellite-6.5.0-7.beta.el7sat.noarch

[root@sat-6-5-qa-rhel7 ~]# hammer template  update --help
Usage:
    hammer template update [OPTIONS]

Options:
 --audit-comment AUDIT_COMMENT              
 --file TEMPLATE                           Path to a file that contains the template
 --id ID                                    
 --location LOCATION_NAME                  Location name
 --location-id LOCATION_ID                  
 --location-ids LOCATION_IDS               REPLACE locations with given ids
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --location-title LOCATION_TITLE           Location title
 --location-titles LOCATION_TITLES         Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --locations LOCATION_NAMES                Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --locked LOCKED                           Whether or not the template is locked for editing
                                           One of true/false, yes/no, 1/0.
 --name NAME                               Name to search by
 --new-name NEW_NAME                       Template name
 --operatingsystem-ids OPERATINGSYSTEM_IDS Array of operating system IDs to associate with the template
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --operatingsystems OPERATINGSYSTEM_TITLES Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organization ORGANIZATION_NAME          Organization name
 --organization-id ORGANIZATION_ID         Organization ID
 --organization-ids ORGANIZATION_IDS       REPLACE organizations with given ids.
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organization-title ORGANIZATION_TITLE   Organization title
 --organization-titles ORGANIZATION_TITLES Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organizations ORGANIZATION_NAMES        Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --type TYPE                               Template type. Eg. snippet, script, provision
 -h, --help                                Print help

[root@sat-6-5-qa-rhel7 ~]# hammer template create --help
Usage:
    hammer template create [OPTIONS]

Options:
 --audit-comment AUDIT_COMMENT              
 --file TEMPLATE                           Path to a file that contains the template
 --location LOCATION_NAME                  Location name
 --location-id LOCATION_ID                  
 --location-ids LOCATION_IDS               REPLACE locations with given ids
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --location-title LOCATION_TITLE           Location title
 --location-titles LOCATION_TITLES         Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --locations LOCATION_NAMES                Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --locked LOCKED                           Whether or not the template is locked for editing
                                           One of true/false, yes/no, 1/0.
 --name NAME                               Template name
 --operatingsystem-ids OPERATINGSYSTEM_IDS Array of operating system IDs to associate with the template
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --operatingsystems OPERATINGSYSTEM_TITLES Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organization ORGANIZATION_NAME          Organization name
 --organization-id ORGANIZATION_ID         Organization ID
 --organization-ids ORGANIZATION_IDS       REPLACE organizations with given ids.
                                           Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organization-title ORGANIZATION_TITLE   Organization title
 --organization-titles ORGANIZATION_TITLES Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --organizations ORGANIZATION_NAMES        Comma separated list of values. Values containing comma should be quoted or escaped with backslash
 --type TYPE                               Template type. Eg. snippet, script, provision
 -h, --help                                Print help

Comment 9 Shira Maximov 2019-03-18 13:47:27 UTC
In order to use the command properly you should run it like that:

$ hammer template combination --help

Usage:
    hammer template combination [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
 SUBCOMMAND                    Subcommand
 [ARG] ...                     Subcommand arguments

Subcommands:
 create                        Add a template combination
 delete                        Delete a template combination
 info                          Show template combination
 list                          List template combination
 update                        Update template combination

Options:
 -h, --help                    Print help

Comment 10 Roman Plevka 2019-03-19 15:40:26 UTC
There seems not to be a way of removing environment or host group from the already existing combination, while i can do that using UI:

[root@sat-6-5-qa-rhel7 foreman]# hammer template combination info --id 5 --provisioning-template-id 46
ID:                         5
Provisioning template ID:   46
Provisioning template name: Kickstart default
Hostgroup ID:               1
Hostgroup name:             foo_hg
Environment ID:             2
Environment name:           foo_env
Created at:                 2019/03/19 15:32:38
Updated at:                 2019/03/19 15:32:38

[root@sat-6-5-qa-rhel7 foreman]# hammer template combination update --id 5 --provisioning-template-id 46 --environment ""
Could not update the template combination:
  Error: environment not found.

Comment 11 Shira Maximov 2019-03-20 10:19:31 UTC
please try to update the combination with NIL as following:
$ hammer template combination  update --id 1 --provisioning-template-id 82 --environment NIL --hostgroup shira
Template combination updated.

Comment 12 Roman Plevka 2019-03-21 12:31:59 UTC
VERIFIED
on sat6.5.0 snap 20

(In reply to Shira Maximov from comment #11)
> please try to update the combination with NIL as following:
> $ hammer template combination  update --id 1 --provisioning-template-id 82
> --environment NIL --hostgroup shira
> Template combination updated.

thanks for suggestion, that works

Comment 14 errata-xmlrpc 2019-05-14 12:36:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


Note You need to log in before you can comment on or make changes to this bug.