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
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
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?
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
On Tuesday, February 14, 2012 at 2: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?
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:
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?
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
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:
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?
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
hu!
Guess I'm out of date... I recall this was a restriction at some point. Is
this a recent change? (or am I loosing my mind?)
On Tue, Feb 14, 2012 at 5:45 PM, Daniel DeLeo dan@kallistec.com wrote:
On Tuesday, February 14, 2012 at 2: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?
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:
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?
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
That's right. I completely forget about knife grep. I use that and it
works fine for me. I must be hitting the Chef bug you mentioend.
Thanks for pointing that out.
On Tue, Feb 14, 2012 at 4:49 PM, AJ Christensen aj@junglist.gen.nz wrote:
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?
Very true and I do this for most things. The reason for this is I
have a very legacy infrastructure that is only partially automated and
I need to get a list of servers that have a particular cron job that
was manually entered.
On Tuesday, February 14, 2012 at 3:13 PM, andi abes wrote:
hu!
Guess I'm out of date... I recall this was a restriction at some point. Is this a recent change? (or am I loosing my mind?)
In Chef 0.8.x and 0.9.x, you could have multiple wildcards, but you could not have wildcards in the key part of the query, and you could not have a wildcard at the start of the value part of the query. Thanks to the new "no fields" index layout, you can now have wildcards in the key (but not at the beginning of the key) and anywhere in the value.
On Tuesday, February 14, 2012 at 2: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?