- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: Re: Re: Re: knife search weirdness. What am I doing wrong here?
- Date: Wed, 15 Feb 2012 11:49:36 +1300
Why even try to find systems by what crontab they have? Surely this is
overcomplicating things.
Adjust the cron from a recipe. Run the recipe from a role. Search for
the system with the role... profit?
Regards,
--AJ
On 15 February 2012 11:45, andi abes
<
>
wrote:
>
can you make your ohai plugin smarter in terms of parsing the cron lines,
>
and split the timing info from the actual command?
>
if you produce something like:
>
>
[ { "timing": " * * * *" , "cmdline": "chef-client"... } { ....} ]
>
>
>
On Tue, Feb 14, 2012 at 5:40 PM, John Alberts
>
<
>
>
wrote:
>
>
>
> Yeah, I think you are right.
>
>
>
> Well, this kind of sucks. :( It ruins my idea of trying to search for
>
> a cronjob. There is no way to actually have knife search that field.
>
> I tried using '*chef' to match the chef-client line, but that returned
>
> 0 results as well.
>
>
>
> Does anyone know if there is a way to match a substring in a value?
>
>
>
> So if my key has a value "blah blah chef-client blah blah", I can find it?
>
>
>
> John
>
>
>
>
>
> On Tue, Feb 14, 2012 at 2:28 PM, andi abes
>
> <
>
>
> wrote:
>
> > I think you can only use one * in a search term.
>
> >
>
> > knife search node "crontabs_root_all_lines:*chef
>
> > or crontabs_root_all_lines:chef*" -a crontabs
>
> >
>
> >
>
> > On Tue, Feb 14, 2012 at 1:46 PM, John Alberts
>
> > <
>
>
> > wrote:
>
> >>
>
> >> I wrote an ohai plugin that puts crontab data in node attributes. The
>
> >> idea was that I wanted to be able to use knife to search for servers
>
> >> with particular cron jobs. Unfortunately, knife search isn't
>
> >> cooperating with me. :/
>
> >>
>
> >> You can see below that using a wildcard for search will return a
>
> >> result, but specifying something that is obviously in the output below
>
> >> yields no results. Am I just getting the syntax wrong?
>
> >>
>
> >>
>
> >>
>
> >> bash-3.2$ knife search node "hostname:dc02vg0039nr* AND
>
> >> crontabs_root_all_lines:*" -a crontabs
>
> >> 1 items found
>
> >>
>
> >> crontabs:
>
> >> root:
>
> >> all_lines: # Chef Name: chef-client
>
> >>
>
> >> PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
>
> >> SHELL=/bin/bash
>
> >> 36 * * * * /usr/local/bin/chef-client > /dev/null 2>&1
>
> >> crons: ["36 * * * * /usr/local/bin/chef-client > /dev/null
>
> >> 2>&1"]
>
> >> id: dc02vg0039nr.internal
>
> >>
>
> >>
>
> >>
>
> >> bash-3.2$ knife search node "hostname:dc02vg0039nr* AND
>
> >> crontabs_root_all_lines:*chef*" -a crontabs
>
> >> 0 items found
>
> >>
>
> >>
>
> >> O'RLY? WTF? :)
>
> >>
>
> >>
>
> >> Thanks
>
> >> John
>
> >
>
> >
>
>
>
>
>
>
>
> --
>
> John Alberts
>
>
Archive powered by MHonArc 2.6.16.