Browse files

Turn the fabric "debug" task into a proper command line option

  • Loading branch information...
1 parent a10c94b commit 88a7d038b6f01d386838d8f90b878dcd036a6d16 @tobami tobami committed Nov 10, 2011
Showing with 25 additions and 15 deletions.
  1. +4 −3 CHANGELOG
  2. +12 −1
  3. +4 −1 fix
  4. +1 −0 littlechef/
  5. +3 −9 littlechef/
  6. +1 −1 tests/
@@ -2,13 +2,14 @@
LittleChef Changelog
-Version NEXT
+Version 1.0.3 November , 2011
* NEW #15 (partly): Automatic metadata.json regeneration from metadata.rb
-* NEW #63: deploy_chef support for CentOS/RHEL v6
-* NEW: Markus added Chef Solo logs (found on /var/log/chef/chef-solo.log)
+* NEW #63: cleonte contributed deploy_chef support for CentOS/RHEL v6
+* NEW #70: Markus added Chef Solo logs (found on /var/log/chef/solo.log)
* FIX #67: Andrew fixed `get_ips` for OSX by adding a regex to parse IPs
+* FIX #66: Remove sensible data from a node after a configuration run
Version 1.0.2 October 11, 2011
@@ -57,6 +57,12 @@ result from merging cookbook, node and role attributes, following the standard
munin_servers = search(:node, "role:#{node['munin']['server_role']} AND chef_environment:node.chef_environment']}")`
+#### Logs ####
+Chef Solo output for a configuration run will be found at the node's
+and the previous configuration run will be moved to solo.log.1
#### metadata.rb and ruby roles ####
LittleChef depends on the JSON versions of the cookbook metadata and roles to properly
@@ -156,6 +162,7 @@ Note that if you already have Chef Solo installed on your nodes, you won't need
Note: Don't cook outside of a kitchen!
+* `fix -v`: Shows the version number
* `fix -l`: Show a list of all available orders
* `fix node:MYNODE recipe:MYRECIPE`: Cook a recipe on a particular node by giving its hostname or IP. "Subrecipes" like `nginx::source` are supported. Note that the first time this is run for a node, a configuration file will be created at `nodes/myhostname.json`. You can then edit this file to override recipe attributes, for example. Further runs of this command will not overwrite this configuration file
* `fix node:MYNODE role:MYROLE`: The same as above but role-based
@@ -165,7 +172,11 @@ Note: Don't cook outside of a kitchen!
* `fix nodes_with_role:ROLE1`: Configures all nodes which have a certain role in their run_list.
* `fix nodes_with_role:ROL*`: Configures all nodes which have at least one role which starts with 'ROL' in their run_list.
* `fix nodes_with_role:ROLE1 env:MYENV`: Configures all nodes in the environment MYENV which have a certain role in their run_list.
-* `fix debug node:MYNODE`: You can start all your commands with `fix debug` to see all Chef Solo debugging information
+* `fix --debug node:MYNODE`: You can start all your commands with `fix --debug` to see
+all Chef Solo debugging information. Also, the node file and node databag wont't be
+deleted from the node.
+* `fix --no-report node:MYNODE`: will prevent the logging of Chef Solo output to
Once a node has a config file, the command you will be using most often is `fix node:MYNODE`, which allows you to repeatedly tweak the recipes and attributes for a node and rerun the configuration.
5 fix
@@ -41,8 +41,11 @@ else:
if '--no-report' in sys.argv:
- littlechef.enable_report = False
+ littlechef.enable_logs = False
+ if '--debug' in sys.argv:
+ littlechef.loglevel = 'debug'
+ sys.argv.remove('--debug')
for arg in sys.argv:
if "env:" in arg:
chef_environment = arg.split(":")[1]
1 littlechef/
@@ -20,6 +20,7 @@
__cooking__ = False
chef_environment = None
+loglevel = "info"
LOGFILE = '/var/log/chef/solo.log'
enable_logs = True
12 littlechef/
@@ -38,13 +38,6 @@
-def debug():
- """Sets logging level to debug"""
- print "Setting Chef Solo log level to 'debug'..."
- env.loglevel = 'debug'
def new_kitchen():
"""Create LittleChef directory structure (Kitchen)"""
def _mkdir(d):
@@ -75,8 +68,8 @@ def _mkdir(d):
def nodes_with_role(rolename):
- """Sets a list of nodes that contain the given role in their run list
- and calls node()
+ """Sets a list of nodes that have the given role
+ in their run list and calls node()
nodes_in_env = []
@@ -386,6 +379,7 @@ def _readconfig():
# Only read config if fix is being used and we are not creating a new kitchen
import littlechef
env.chef_environment = littlechef.chef_environment
+env.loglevel = littlechef.loglevel
if littlechef.__cooking__:
# Called from command line
2 tests/
@@ -81,7 +81,7 @@ def test_list_commands(self):
self.assertEquals(error, "")
expected = "LittleChef: Configuration Management using Chef Solo"
self.assertTrue(expected in resp)
- self.assertEquals(len(resp.split('\n')), 21)
+ self.assertEquals(len(resp.split('\n')), 20)
class TestEnvironment(BaseTest):

0 comments on commit 88a7d03

Please sign in to comment.