Project

General

Profile

Bug #5133

hammer product update requires both ID and NAME

Added by Og Maciel almost 8 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

To update a product using hammer cli, you need to pass both ID and NAME of the product, which goes against what other hammer commands do.

[root@qeblade35 ~]# hammer -v product info --id 88
ID:           88
Name:         Forge
Label:        Forge
Description:
Sync Plan ID:
Sync State:   not_synced
Sync Plan ID:
GPG:
    GPG Key ID:
    GPG Key:
Organization: ACME_Corporation
Readonly:     false
Deletable:    true
Content:
 1) Repo Name: Puppet Labs Forge
    URL:       /custom/Forge/Puppet_Labs_Forge

[root@qeblade35 ~]# hammer -v product update --id 88 --sync-plan-id 1
[ERROR 2014-04-08 16:30:41 Exception] Error: option '--name' is required

See: 'hammer product update --help'
Could not update the product:
  Error: option '--name' is required

  See: 'hammer product update --help'
[ERROR 2014-04-08 16:30:41 Exception]

Clamp::UsageError (option '--name' is required):
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/option/parsing.rb:53:in `parse_options'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/option/parsing.rb:45:in `each'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/option/parsing.rb:45:in `parse_options'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:52:in `parse'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:30:in `parse'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:66:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
    /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.0/bin/hammer:100
    /usr/bin/hammer:19:in `load'
    /usr/bin/hammer:19
[root@qeblade35 ~]# hammer -v product update --id 88 --name Forge --sync-plan-id 1
Product updated
[root@qeblade35 ~]# hammer -v product info --id 88

ID:           88
Name:         Forge
Label:        Forge
Description:
Sync Plan ID: 1
Sync State:   not_synced
Sync Plan ID: 1
GPG:
    GPG Key ID:
    GPG Key:
Organization: ACME_Corporation
Readonly:     false
Deletable:    true
Content:
 1) Repo Name: Puppet Labs Forge
    URL:       /custom/Forge/Puppet_Labs_Forge

As you can see, it was only after I added the product name that I was able to associate an existing sync plan to the product.

This is related to https://bugzilla.redhat.com/show_bug.cgi?id=1085536

Associated revisions

Revision 86fc5c1b (diff)
Added by Og Maciel almost 8 years ago

Allows updates of Products by ID only.

Currently one has to provide both the Product's ID and NAME to update
any of the available fields. This change should allow us to update a
product by using only its ID. Fixes #5133 and BZ 1085536.

Note that since a product label cannot be updated, I removed it from the
param_group set and manually added it to the create method (optional).

History

#1 Updated by Og Maciel almost 8 years ago

  • Status changed from New to Closed

#2 Updated by Eric Helms over 7 years ago

  • Triaged changed from No to Yes

#3 Updated by Eric Helms over 7 years ago

  • Legacy Backlogs Release (now unused) set to 13

Also available in: Atom PDF