Description
This generates both the correct Opscode chef command the corresponding json file to use.
Documentation on Chef-Solo options:
- http://docs.opscode.com/chef_solo.html
- http://docs.opscode.com/ctl_chef_solo.html
- http://docs.opscode.com/config_rb_solo.html
Documentation on Chef-Client options:
API
Constructor
var ChefCommand = require('chef-command');
var chefCmd = new ChefCommand();
options:
executable
: defaults to chef-solofile_cache_path
:dna_json_path
:role_path
:environment_path
:data_bag_path
:config_rb_path
:log_level
:cookbook_path
:run_list
:extra_json
: // extra json to merge in the dna.json
Instance variables
- settings : a hash containing all settings
Instance methods
var ChefCommand = require('chef-command');
var chefCmd = new ChefCommand();
chefCmd.addCookbookPath('/tmp/cookbooks'); // add a cookbook
chefCmd.addCookbookPath('/tmp/site-cookbooks').logLevel('debug'); // example of chainable
addCookbookPath(path)
: adds a CookbookPath + returns chainable selfremoveCookbookPath(path)
: removes a CookbookPath + returns chainable selfaddRolePath(path)
: adds a RolePath + returns chainable selfremoveRolePath(path)
: removes a RolePath + returns chainable selfaddDataBagPath(path)
: adds a DataBagPath + returns chainable selfremoveDataBagPath(path)
: removes a DataBagPath + returns chainable selfsetExecutable(command)
: sets the executable command to commandsetLogLevel(level)
: sets the LogLevel + returns chainable selfaddRecipe(recipe)
: adds recipe to the runlistaddRole(role)
: adds role to the run runlistsetRunList(array of runlist)
: sets the runlistsetExtraJson(json)
: json to merge with dna.jsonremoveRole(role)
: removes the role from the runlistremoveRecipe(recipe)
: removes the recipe to the runlist
Getters
var ChefCommand = require('chef-command');
var chefCmd = new ChefCommand();
chefCmd.addCookbookPath('/tmp/cookbooks'); // add a cookbook
chefCmd.generate();
-
generate() : return hash containing
-
dna_json
: string containing the dna.json to use -
config_rb
: string containing the config.rb -
command
: string containing the actual CLI invocation