Hammer-cli help getting options into hammer-cli-katello

Need some assistance: At the moment, some command options are only available before the command

% hammer -u admin -p changeme architecture list
% hammer architecture list -u admin -p changeme <-- unrecognized option '-u'

How do I make those options available to the ListCommand?

I am trying to write spec tests and want to actually hit a running server without mocking and I just can't seem to get parameters passed in correctly.

··· -- @thomasmckay


“The leader must aim high, see big, judge widely, thus setting himself apart form the ordinary people who debate in narrow confines.” ~ Charles De Gaulle

“Leadership is about making others better as a result of your presence and making sure that impact lasts in your absence.” ~ Harvard Business School

Managed to accomplish what I wanted by (roughly) the following:

HammerCLI::Settings.load_from_file ['test/config.yml']
HammerCLI::Settings.load({
:_params => {
:username => username,
:password => password,
:interactive => false
}})
hammer = HammerCLI::MainCommand.new("", ctx)
hammer.run(%W{activation-key list --organization-id megacorp}).must_equal HammerCLI::EX_OK

··· ----- Original Message ----- > From: "Tom McKay" > To: foreman-dev@googlegroups.com > Sent: Saturday, February 15, 2014 12:57:47 PM > Subject: [foreman-dev] hammer-cli help getting options into hammer-cli-katello > > > Need some assistance: At the moment, some command options are only available > before the command > > % hammer -u admin -p changeme architecture list > % hammer architecture list -u admin -p changeme <-- unrecognized option > '-u' > > How do I make those options available to the ListCommand? > > I am trying to write spec tests and want to actually hit a running server > without mocking and I just can't seem to get parameters passed in correctly. > > > -- > @thomasmckay > > -- > "The leader must aim high, see big, judge widely, thus setting himself apart > form the ordinary people who debate in narrow confines." ~ Charles De Gaulle > > "Leadership is about making others better as a result of your presence and > making sure that impact lasts in your absence." ~ Harvard Business School > > -- > You received this message because you are subscribed to the Google Groups > "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. >

> From: "Tom McKay" <thomasmckay@redhat.com>
> To: foreman-dev@googlegroups.com
> Sent: Saturday, February 15, 2014 7:22:22 PM
> Subject: Re: [foreman-dev] hammer-cli help getting options into hammer-cli-katello
>
>
>
> > From: "Tom McKay" <thomasmckay@redhat.com>
> > To: foreman-dev@googlegroups.com
> > Sent: Saturday, February 15, 2014 12:57:47 PM
> > Subject: [foreman-dev] hammer-cli help getting options into
> > hammer-cli-katello
> >
> >
> > Need some assistance: At the moment, some command options are only
> > available
> > before the command
> >
> > % hammer -u admin -p changeme architecture list
> > % hammer architecture list -u admin -p changeme <-- unrecognized option
> > '-u'
> >
> > How do I make those options available to the ListCommand?

tom, these options are hammer global options so they need to come before your action and command:

hammer -u admin -p changeme architecture list

··· ----- Original Message ----- > ----- Original Message -----

I am trying to write spec tests and want to actually hit a running server
without mocking and I just can’t seem to get parameters passed in
correctly.


@thomasmckay


“The leader must aim high, see big, judge widely, thus setting himself
apart
form the ordinary people who debate in narrow confines.” ~ Charles De
Gaulle

“Leadership is about making others better as a result of your presence and
making sure that impact lasts in your absence.” ~ Harvard Business School


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Managed to accomplish what I wanted by (roughly) the following:

HammerCLI::Settings.load_from_file [‘test/config.yml’]
HammerCLI::Settings.load({
:_params => {
:username => username,
:password => password,
:interactive => false
}})
hammer = HammerCLI::MainCommand.new("", ctx)
hammer.run(%W{activation-key list --organization-id megacorp}).must_equal
HammerCLI::EX_OK


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  • adam price