- From: "John E. Vincent (lusis)" <
>
- To:
- Subject: [chef] Re: Re: Re: Re: knife search weirdness. What am I doing wrong here?
- Date: Tue, 14 Feb 2012 19:20:17 -0500
Or even better if you really need this information (which I can
actually think of reasons), have the data in ohai look like this:
"cron":{
"some_job_name":{
"minute":"",
"hour":"",
"day":"",
"command":"foo command.sh arg1"
You get the idea. it doesn't express cleanly but it works and, like I
said, I can see a use case over doing it in a cookbook.
On Tue, Feb 14, 2012 at 5:45 PM, 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.