[chef] Re: Why I cannot search by recipes attribute only. Other attributes in search are still working.


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Why I cannot search by recipes attribute only. Other attributes in search are still working.
  • Date: Tue, 20 Aug 2013 00:00:06 -0700

Recipes and roles are two node attributes, populated during node building, as part of chef run (check client.rb for phases in a chef run). Iteresting values of these two attributes comes from run list expansions, which populates an array of recipe as it parses the items in run list. Note, both are  automatic attributes, some thing similar to ohai.
Now,
if you want to check all recipes against a node, if you can use the run_context.loaded_recipes (most probably). this trick will work as long as you are searching against the current running node and the recipe you are searching is included before the code block where you are checking this.

We internally use a handler  that exposes these info as node.chef_metrics.loaded_recipes (with few other staff).


On Mon, Aug 19, 2013 at 11:27 PM, Vladimir Skubriev < " target="_blank"> > wrote:
$knife search node "recipes:cftp"


knife search node "hostname:zeus" -l | grep -C 10 recipes
        metric:      256
        proto:       kernel
      state:         unknown
      type:          vnet
ohai_time:        1376978220.81941
os:               linux
os_version:       3.5.0-34-generic
platform:         ubuntu
platform_family:  debian
platform_version: 12.04
recipes:
  apt
  ntp
  cftp
  cnfs::server
  cinotify
  nut
  fail2ban
  csquiddebproxy::server
  csquiddebproxy
  cbacula::client


OR other example:

knife search node "roles:ntp_server" -l | grep -C 10 roles
  apt
  ntp
  cftp
  cnfs::server
  cinotify
  nut
  fail2ban
  csquiddebproxy::server
  csquiddebproxy
  cbacula::client
roles:
  ntp_server
  nut_apcrt5000xl_serverroom_server
uptime:           6 days 21 hours 09 minutes 00 seconds
uptime_seconds:   594540
virtualization:
  role:   host
  system: kvm


What is the difference between roles and recipes attributes. Why with recipes search are not work ?

Thank you very much.

--
Best regards,

CVisionLab System Administrator
Vladmir Skubriev





Archive powered by MHonArc 2.6.16.

§