summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-17 13:34:51 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-17 13:34:58 -0400
commit293d614caa0cfec6b2f403d79ee52de9df8b18cd (patch)
tree89c7d43ac462abc2040330484b4196e290af99bb
parent85009dc89ee3434e3ffe07b0f96e9385968b3950 (diff)
downloadbcfg2-293d614caa0cfec6b2f403d79ee52de9df8b18cd.tar.gz
bcfg2-293d614caa0cfec6b2f403d79ee52de9df8b18cd.tar.bz2
bcfg2-293d614caa0cfec6b2f403d79ee52de9df8b18cd.zip
set up bcfg2-info logging just like bcfg2-admin
-rw-r--r--src/lib/Bcfg2/Server/Admin/Client.py2
-rw-r--r--src/lib/Bcfg2/Server/Admin/__init__.py2
-rwxr-xr-xsrc/sbin/bcfg2-info14
3 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Client.py b/src/lib/Bcfg2/Server/Admin/Client.py
index 67f517417..b7916fab9 100644
--- a/src/lib/Bcfg2/Server/Admin/Client.py
+++ b/src/lib/Bcfg2/Server/Admin/Client.py
@@ -29,7 +29,7 @@ class Client(Bcfg2.Server.Admin.MetadataCore):
raise SystemExit(1)
elif args[0] in ['list', 'ls']:
for client in self.metadata.list_clients():
- print(client.hostname)
+ print(client)
else:
print("No command specified")
raise SystemExit(1)
diff --git a/src/lib/Bcfg2/Server/Admin/__init__.py b/src/lib/Bcfg2/Server/Admin/__init__.py
index df9a45cd5..19175533f 100644
--- a/src/lib/Bcfg2/Server/Admin/__init__.py
+++ b/src/lib/Bcfg2/Server/Admin/__init__.py
@@ -138,7 +138,7 @@ class MetadataCore(Mode):
setup['plugins'] = [p for p in setup['plugins']
if p not in self.__plugin_blacklist__]
- # admin modes con't need to watch for changes. one shot is fine here.
+ # admin modes don't need to watch for changes. one shot is fine here.
setup['filemonitor'] = 'pseudo'
try:
self.bcore = Bcfg2.Server.Core.BaseCore(setup)
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 4c5d8f785..efc6041c9 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -7,6 +7,7 @@ import sys
import cmd
import getopt
import fnmatch
+import logging
import lxml.etree
import traceback
from code import InteractiveConsole
@@ -122,11 +123,7 @@ class InfoCore(cmd.Cmd, Bcfg2.Server.Core.BaseCore):
"""Main class for bcfg2-info."""
def __init__(self, setup):
cmd.Cmd.__init__(self)
- saved = (setup['syslog'], setup['logging'])
- setup['syslog'] = False
- setup['logging'] = None
Bcfg2.Server.Core.BaseCore.__init__(self, setup=setup)
- setup['syslog'], setup['logging'] = saved
self.prompt = '> '
self.cont = True
self.fam.handle_events_in_interval(4)
@@ -769,6 +766,15 @@ def main():
USAGE])
setup.parse(sys.argv[1:])
+
+ if setup['debug']:
+ level = logging.DEBUG
+ elif setup['verbose']:
+ level = logging.INFO
+ else:
+ level = logging.WARNING
+ Bcfg2.Logger.setup_logging('bcfg2-info', to_syslog=False, level=level)
+
if setup['args'] and setup['args'][0] == 'help':
print(setup.hm)
sys.exit(0)