Hammer sort output?

Hi,

How do I sort the output when listing facts in hammer?

hammer -u admin -p admin fact list --search "host.hostgroup = MYGROUP and
fact = operatingsystem" --per-page 100

··· ------------------------------------------------------ HOST | FACT | VALUE ------------------------------------------------------ host22.mydomain.com | operatingsystem | RedHat host20.mydomain.com | operatingsystem | RedHat host18.mydomain.com | operatingsystem | RedHat host13.mydomain.com | operatingsystem | RedHat

I would like to sort by hostname so expected output would be:


HOST | FACT | VALUE

host13.mydomain.com | operatingsystem | RedHat
host18.mydomain.com | operatingsystem | RedHat
host20.mydomain.com | operatingsystem | RedHat
host22.mydomain.com | operatingsystem | RedHat

Is this possible? I’m looking to export facts and hammer fits the bill, I
just need to be able to sort the output!

Version details are:

foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
rubygem-hammer_cli-0.0.18-1.el6.noarch

Thanks,

Thanks for the quick reply.

Using --order still gives a random output

There is --order option for that

$>hammer fact list -h

Usage:
hammer fact list [OPTIONS]

Options:
–order ORDER sort results
–page PAGE paginate results
–per-page PER_PAGE number of entries per request
–search SEARCH filter results
-h, --help print help

$>hammer fact list --search 'fact = operatingsystem' --order 'host asc'

Regards,
Martin

··· On 03/28/2014 03:18 PM, Oleg Mcnoleg wrote: > Hi, > > How do I sort the output when listing facts in hammer? > > hammer -u admin -p admin fact list --search "host.hostgroup = > MYGROUP and fact = operatingsystem" --per-page 100 > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host22.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host13.mydomain.com | operatingsystem | RedHat > > I would like to sort by hostname so expected output would be: > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host13.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host22.mydomain.com | operatingsystem | RedHat > > Is this possible? I'm looking to export facts and hammer fits the > bill, I just need to be able to sort the output! > > Version details are: > > foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch > rubygem-hammer_cli-0.0.18-1.el6.noarch > > Thanks, > >

Same for me.
hammer fact list --search 'fact = operatingsystem' --order 'host asc'
gives random order.

··· пятница, 28 марта 2014 г., 18:18:59 UTC+4 пользователь Oleg Mcnoleg написал: > > Hi, > > How do I sort the output when listing facts in hammer? > > hammer -u admin -p admin fact list --search "host.hostgroup = MYGROUP > and fact = operatingsystem" --per-page 100 > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host22.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host13.mydomain.com | operatingsystem | RedHat > > I would like to sort by hostname so expected output would be: > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host13.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host22.mydomain.com | operatingsystem | RedHat > > Is this possible? I'm looking to export facts and hammer fits the bill, I > just need to be able to sort the output! > > Version details are: > > foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch > rubygem-hammer_cli-0.0.18-1.el6.noarch > > Thanks, > > >

Well, I have updated to:

[root@puppet reports]# rpm -qa | grep -E 'hammer|foreman'
rubygem-hammer_cli_foreman-0.1.1-1.el6.noarch
foreman-1.5.1-1.el6.noarch
foreman-postgresql-1.5.1-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-release-1.5.1-1.el6.noarch
foreman-proxy-1.5.1-1.el6.noarch
rubygem-hammer_cli-0.1.1-1.el6.noarch
foreman-installer-1.5.1-1.el6.noarch

But still getting random order.
hammer fact list --search 'fact = operatingsystem' --order 'host asc'

··· пятница, 28 марта 2014 г., 18:18:59 UTC+4 пользователь Oleg Mcnoleg написал: > > Hi, > > How do I sort the output when listing facts in hammer? > > hammer -u admin -p admin fact list --search "host.hostgroup = MYGROUP > and fact = operatingsystem" --per-page 100 > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host22.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host13.mydomain.com | operatingsystem | RedHat > > I would like to sort by hostname so expected output would be: > > ------------------------------------------------------ > HOST | FACT | VALUE > ------------------------------------------------------ > host13.mydomain.com | operatingsystem | RedHat > host18.mydomain.com | operatingsystem | RedHat > host20.mydomain.com | operatingsystem | RedHat > host22.mydomain.com | operatingsystem | RedHat > > Is this possible? I'm looking to export facts and hammer fits the bill, I > just need to be able to sort the output! > > Version details are: > > foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch > rubygem-hammer_cli-0.0.18-1.el6.noarch > > Thanks, > > >

> Same for me.
> hammer fact list --search 'fact = operatingsystem' --order 'host asc'
> gives random order.
>
>
Hi Alex,

on my Foreman 1.5 and hammer 0.1.1 it worked as expected. What version
of Foreman and Hammer do you use?

Martin

··· On 06/30/2014 02:58 PM, Alex B wrote:

пятница, 28 марта 2014 г., 18:18:59 UTC+4 пользователь Oleg Mcnoleg > написал:

Hi,

How do I sort the output when listing facts in hammer?

hammer -u admin  -p admin  fact list --search "host.hostgroup =
MYGROUP and fact = operatingsystem" --per-page 100

------------------------------------------------------
HOST                        | FACT            | VALUE
------------------------------------------------------
host22.mydomain.com <http://host22.mydomain.com>    |
operatingsystem | RedHat
host20.mydomain.com <http://host20.mydomain.com>    |
operatingsystem | RedHat
host18.mydomain.com <http://host18.mydomain.com>    |
operatingsystem | RedHat
host13.mydomain.com <http://host13.mydomain.com>    |
operatingsystem | RedHat

I would like to sort by hostname so expected output would be:

------------------------------------------------------
HOST                        | FACT            | VALUE
------------------------------------------------------
host13.mydomain.com <http://host13.mydomain.com>    |
operatingsystem | RedHat
host18.mydomain.com <http://host18.mydomain.com>    |
operatingsystem | RedHat
host20.mydomain.com <http://host20.mydomain.com>    |
operatingsystem | RedHat
host22.mydomain.com <http://host22.mydomain.com>    |
operatingsystem | RedHat

Is this possible? I'm looking to export facts and hammer fits the
bill, I just need to be able to sort the output!

Version details are:

foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
rubygem-hammer_cli-0.0.18-1.el6.noarch

Thanks,


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

rpm -qa | grep -E 'hammer|foreman'

rubygem-hammer_cli-0.0.18-1.el6.noarch
foreman-proxy-1.4.1-1.el6.noarch
foreman-postgresql-1.4.1-2.el6.noarch
foreman-installer-1.4.1-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-1.4.1-2.el6.noarch
rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
foreman-release-1.4.1-2.el6.noarch

Yes, I should update and check new version.

··· понедельник, 30 июня 2014 г., 17:27:09 UTC+4 пользователь Martin Bačovský написал: > > On 06/30/2014 02:58 PM, Alex B wrote: > > Same for me. > hammer fact list --search 'fact = operatingsystem' --order 'host asc' > gives random order. > > > Hi Alex, > > on my Foreman 1.5 and hammer 0.1.1 it worked as expected. What version of > Foreman and Hammer do you use? > > Martin > > пятница, 28 марта 2014 г., 18:18:59 UTC+4 пользователь Oleg Mcnoleg > написал: >> >> Hi, >> >> How do I sort the output when listing facts in hammer? >> >> hammer -u admin -p admin fact list --search "host.hostgroup = MYGROUP >> and fact = operatingsystem" --per-page 100 >> >> ------------------------------------------------------ >> HOST | FACT | VALUE >> ------------------------------------------------------ >> host22.mydomain.com | operatingsystem | RedHat >> host20.mydomain.com | operatingsystem | RedHat >> host18.mydomain.com | operatingsystem | RedHat >> host13.mydomain.com | operatingsystem | RedHat >> >> I would like to sort by hostname so expected output would be: >> >> ------------------------------------------------------ >> HOST | FACT | VALUE >> ------------------------------------------------------ >> host13.mydomain.com | operatingsystem | RedHat >> host18.mydomain.com | operatingsystem | RedHat >> host20.mydomain.com | operatingsystem | RedHat >> host22.mydomain.com | operatingsystem | RedHat >> >> Is this possible? I'm looking to export facts and hammer fits the bill, >> I just need to be able to sort the output! >> >> Version details are: >> >> foreman-1.4.2-1.el6.noarchrubygem-hammer_cli_foreman-0.0.18-1.el6.noarch >> rubygem-hammer_cli-0.0.18-1.el6.noarch >> >> Thanks, >> >> >> -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-user...@googlegroups.com . > To post to this group, send email to forema...@googlegroups.com > . > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout. > > >