Permalink
Browse files

Add verbose option and make false the default

Feature introduced by Chef 0.10.6, which makes it possible to switch off the "Processing" statements
  • Loading branch information...
1 parent b257f67 commit f51441c552c21a27f8fbfb4304ec16b087238f2e @tobami committed Dec 14, 2011
Showing with 29 additions and 3 deletions.
  1. +2 −1 README.md
  2. +9 −1 fix
  3. +1 −0 littlechef/__init__.py
  4. +2 −0 littlechef/runner.py
  5. +2 −1 littlechef/solo.py
  6. +1 −0 littlechef/solo.rb
  7. +12 −0 tests/test_command.py
View
@@ -181,9 +181,10 @@ the `ipaddress` attribute
Options:
* `fix --env=MYENV nodes_with_role:ROLE1`: Configures all nodes in the environment MYENV which have a certain role in their run_list.
+* `fix --verbose node:MYNODE`: Chef 0.10.6 introduced the `verbose_logging` option. When false, the "processing" messages are not longer shown. That is the new default for LittleChef, so that you now only see what has changed in this configuration run. `--verbose` switches this back on.
* `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.
+deleted from the node, and verbose will also be true
* `fix --no-report node:MYNODE`: will prevent the logging of Chef Solo output to
/var/log/chef/
View
@@ -51,8 +51,12 @@ parser.add_option(
help="Don't save the chef-solo output as a report on the node"
)
parser.add_option(
+ "--verbose", dest="verbose", action="store_true", default=False,
+ help="Output 'processing' statements"
+)
+parser.add_option(
"--debug", dest="debug", action="store_true", default=False,
- help="Ask chef-solo for verbose debugging output"
+ help="Ask chef-solo for verbose and debugging output"
)
parser.add_option(
"--env", dest="environment", default=None,
@@ -80,8 +84,12 @@ else:
if options.no_report:
littlechef.enable_logs = False
sys.argv.remove('--no-report')
+ if options.verbose:
+ littlechef.verbose = True
+ sys.argv.remove('--verbose')
if options.debug:
littlechef.loglevel = 'debug'
+ littlechef.verbose = True
sys.argv.remove('--debug')
if options.environment is not None:
# Check for mistakes:
@@ -21,5 +21,6 @@
chef_environment = None
loglevel = "info"
+verbose = False
LOGFILE = '/var/log/chef/solo.log'
enable_logs = True
@@ -397,6 +397,8 @@ def _readconfig():
import littlechef
env.chef_environment = littlechef.chef_environment
env.loglevel = littlechef.loglevel
+env.verbose = littlechef.verbose
+
if littlechef.__cooking__:
# Called from command line
View
@@ -84,7 +84,8 @@ def configure(current_node=None):
data = {
'node_work_path': node_work_path,
'cookbook_paths_list': cookbook_paths_list,
- 'environment': current_node.get('chef_environment', '_default')
+ 'environment': current_node.get('chef_environment', '_default'),
+ 'verbose': "true" if env.verbose else "false"
}
with hide('running', 'stdout'):
upload_template(os.path.join(BASEDIR, 'solo.rb'), '/etc/chef/',
View
@@ -3,3 +3,4 @@
role_path "%(node_work_path)s/roles"
data_bag_path "%(node_work_path)s/data_bags"
environment "%(environment)s"
+verbose_logging %(verbose)s
View
@@ -83,6 +83,18 @@ def test_list_commands(self):
self.assertTrue(expected in resp)
self.assertEquals(len(resp.split('\n')), 21)
+ #def test_verbose(self):
+ #"""Should turn on verbose output"""
+ #resp, error = self.execute([fix, '--verbose', 'node:testnode1'])
+ #self.assertEquals(error, "", error)
+ #self.assertTrue('Verbose output on' in resp, resp)
+
+ #def test_debug(self):
+ #"""Should turn on debug loglevel"""
+ #resp, error = self.execute([fix, '--debug', 'node:testnode1'])
+ #self.assertEquals(error, "", error)
+ #self.assertTrue('Debug on' in resp, resp)
+
class TestEnvironment(BaseTest):
def test_no_valid_value(self):

0 comments on commit f51441c

Please sign in to comment.