powellnathanj / mcollective-yum-agent

http://nathanpowell.org
17 stars 11 forks source link

Feature request: yum list #3

Closed snobear closed 8 years ago

snobear commented 10 years ago

Thanks for the yum plugin! Just adding a feature request for yum list or yum list installed so you can discover what package versions are installed.

I know you can do this with mco package status package=foo, but I'd like to be able to disable the mco package plugin altogether since I've got a yum-centric version now, mainly to avoid someone from installing something outside of yum.

powellnathanj commented 10 years ago

Sure no problem, I can add both of those. I want to add repolist to it as well. Give me until next week.

I am probably going to deprecate this repository and create two new ones to separate shellout from yum. The Yum agent gets a lot more use, and the shellout agent scares people. So if people want to manage updates with git, they end up with the whole repo. I also want to follow some of the Puppet Labs conventions.

snobear commented 10 years ago

@slaney Excellent, thanks. Sounds like a good idea to separate them. Yeah, people say to avoid using shell command plugins and that each command or "task" should be its own plugin. This was annoying to me at first, but I can see that it prevents you from doing serious damage and adds some rigor into your workflow. Or something like that :).

powellnathanj commented 10 years ago

I have committed a first pass at adding the functionality. If you have a way to test, can you provide any feedback? I might mess around with it some more, but I wanted to let you know it was now in the repo.

Thanks

snobear commented 10 years ago

You the man. I'll give it a test and let you know!

snobear commented 10 years ago

My tests look good using:

mco rpc yum list -I test04

That returns every package that is in every yum repo, which isn't super useful. Great start though.

These are the commands I commonly use when interrogating packages on a system. So, in mco speak, I'd love to have these options:

Also for the first one, it'd be good to see a column for installed vs. not installed. Should be able to grab that from the yum output. Thanks!

snobear commented 10 years ago

Oh I see you have those options...let me RTFM and test again.

powellnathanj commented 10 years ago

Yeah, let me know. I am open to changing it around. Like I said, this was just a first pass. If you think package= makes more sense I can do that.

I don't use list terribly often, so I am open to feedback. Thanks.

On Tue, Oct 14, 2014 at 12:56 PM, Jason Ashby notifications@github.com wrote:

Oh I see you have those options...let me RTFM and test again.

— Reply to this email directly or view it on GitHub https://github.com/slaney/mcollective-yum-agent/issues/3#issuecomment-59078717 .

Nathan Powell

snobear commented 10 years ago

OK I see -

mco rpc yum list options="installed" options="kernel" -I test04
test04
   exitcode: 0
     Output: Loaded plugins: downloadonly, fastestmirror, security
             Loading mirror speeds from cached hostfile
             Installed Packages
             kernel.x86_64    2.6.32-431.5.1.el6     @Dev-CentOS65-updates-x86_64
             kernel.x86_64    2.6.32-431.23.3.el6    @Dev-CentOS65-updates-x86_64
             Available Packages
             kernel.i686      2.6.32-431.23.3.el6    Dev-CentOS65-updates-i386

Yeah I think using the package input would be most intuitive, and to have installed and available be subommands/subactions or whatever they're called. How I laid it out above would be optimal.

I'd lend a hand but I'm working on a couple other mco agents. I'm new to mcollective, so still learning the ropes too.

snobear commented 10 years ago

Just an extra thought, but I'm wondering if you can split the output into separate fields:

I'd imagine that would allow you to use the -j mcollective switch to return it in json output if you wanted to import into a script for analysis.

If yum doesn't have a special option to return friendly output, you could probably just split on spaces.

powellnathanj commented 10 years ago

So, first let's agree on the syntax (I will get to output parsing in a sec) are you envisioning an options, and a package parameter like:

sudo mco rpc yum list options="installed" package="kernel"

snobear commented 10 years ago

Yes, I agree on what you suggested there, i.e. having an options= and a package= param.

powellnathanj commented 10 years ago

Check out what I have now. I'll look at splitting the output, but the basic functionality you requested is there. If you find any issues, just hit me up.

The usage is documented in the Readme.

Thanks

snobear commented 10 years ago

@slaney most excellent - I'll check it out hopefully tomorrow or Thursday. This yum plugin has been real helpful, so thanks again.

snobear commented 9 years ago

Hi @slaney, sorry for the delay. I pulled down your updates on the two servers I was testing (an mco client and a regular mco server), but I'm still seeing a full list of packages and not just kernel when I do the following:

mco rpc yum list options="installed" package="kernel" -I test04

Can you double-check it works as expected with whatever is in the latest master? Could be I'm missing something on the admin client side.

powellnathanj commented 9 years ago

You have the plurality reversed. It's "option" and "packages"

Sent from my iPhone

On Nov 7, 2014, at 8:36 AM, Jason Ashby notifications@github.com wrote:

Hi @slaney, sorry for the delay. I pulled down your updates on the two servers I was testing (an mco client and a regular mco server), but I'm still seeing a full list of packages and not just kernel when I do the following:

mco rpc yum list options="installed" package="kernel" -I test04 Can you double-check it works as expected with whatever is in the latest master? Could be I'm missing something on the admin client side.

— Reply to this email directly or view it on GitHub.

snobear commented 9 years ago

Ahh yes that was the problem. Looks great and works as advertised. :+1:

powellnathanj commented 8 years ago

I just realized I never closed this issue. Derp.