Ticket #1008 (closed defect: fixed)
Logging Traceback When bcfg2-server, bcfg2-lint, and bcfg2-admin are Run
Reported by: | rcuza | Owned by: | solj |
---|---|---|---|
Priority: | minor | Milestone: | Bcfg2 1.2.0 Release |
Component: | bcfg2-server | Version: | 1.0 |
Keywords: | Cc: | [email protected]… |
Description
Trying to reproduce problems people new to Bcfg2 may encounter.
After doing a fresh install of v1.2.0pre2 from the PKG made in the osx directory, I get the following traceback when trying to run bcfg2-server as a regular user or root.
With /etc/bcfg2.conf owned by root but readable by everyone:
Failed to load Base repository Failed to instantiate plugin Base Failed to load Bundle repository Failed to instantiate plugin Bundler Failed to open directory /var/lib/bcfg2/Cfg/ Unable to add file monitor for groups.xml or clients.xml Failed to instantiate plugin Metadata Failed to load /var/lib/bcfg2/Pkgmgr indices Failed to instantiate plugin Pkgmgr Failed to load /var/lib/bcfg2/Rules indices Failed to instantiate plugin Rules Unexpected instantiation failure for plugin SSHbase Traceback (most recent call last): File "/Library/Python/2.6/site-packages/Bcfg2/Server/Core.py", line 165, in init_plugins self.plugins[plugin] = plug(self, self.datastore) File "/Library/Python/2.6/site-packages/Bcfg2/Server/Plugins/SSHbase.py", line 56, in __init__ ioerr = sys.exc_info()[1] NameError: global name 'sys' is not defined No Metadata Plugin loaded; failed to instantiate Core No Metadata Plugin Traceback (most recent call last): File "/usr/local/bin/bcfg2-server", line 74, in <module> logger.error(msg) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1047, in error self._log(ERROR, msg, args, **kwargs) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1129, in _log self.handle(record) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1139, in handle self.callHandlers(record) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 1176, in callHandlers hdlr.handle(record) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py", line 662, in handle self.emit(record) File "/Library/Python/2.6/site-packages/Bcfg2/Logger.py", line 121, in emit if len(record.msg) > 250: TypeError: object of type 'CoreInitError' has no len() SunCityComputer:~ raulc$ ls /var/lib/bcfg2/Cfg/ ls: /var/lib/bcfg2/Cfg/: No such file or directory
When bcfg2.conf doesn't exist, I get the following error:
Could not read /etc/bcfg2.conf
Expected results: No traceback errors on command line and helpful error message.
The existing /etc/bcfg2.conf is as follows:
[communication] protocol = xmlrpc/ssl password = babydesaisaysNI # certificate = /etc/bcfg2.key # key = /etc/bcfg2.key [components] bcfg2 = https://localhost:6789 SunCityComputer:~ raulc$ cat /etc/bcfg2-test.conf [communication] protocol = xmlrpc/ssl password = foobat # certificate = /etc/bcfg2.key # key = /etc/bcfg2.key [components] bcfg2 = https://localhost:6789
Also, there is no Bcfg2 repository:
$ ls -d /var/lib/bcfg2 ls: /var/lib/bcfg2: No such file or directory
Tested on Mac OS X 10.6.7 (python 2.6.1).
Attachments
Change History
comment:2 Changed 12 years ago by rcuza
While trying to see if it was my uninitiated state that was causing the problem I got the following error:
$ sudo bcfg2-admin init Store Bcfg2 configuration in [/etc/bcfg2.conf]: Location of Bcfg2 repository [/var/lib/bcfg2]: Input password used for communication verification (without echoing; leave blank for a random): What is the server's hostname [example.local]: localhost Input the server location [https://example.local:6789]: https://localhost:6789/ Input base Operating System for clients: 1: Red Hat/Fedora/RHEL/RHAS/Centos 2: SUSE/SLES 3: Mandrake 4: Debian 5: Ubuntu 6: Gentoo 7: FreeBSD : 7 The following questions affect SSL certificate generation. If no data is provided, the default values are used. Country name (2 letter code) for certificate: us State or Province Name (full name) for certificate: new york Locality Name (eg, city) for certificate: new york Traceback (most recent call last): File "/usr/local/bin/bcfg2-admin", line 83, in <module> main() File "/usr/local/bin/bcfg2-admin", line 72, in main mode(args[1:]) File "/Library/Python/2.6/site-packages/Bcfg2/Server/Admin/Init.py", line 210, in __call__ self.init_repo() File "/Library/Python/2.6/site-packages/Bcfg2/Server/Admin/Init.py", line 404, in init_repo create_conf(self.configfile, confdata) File "/Library/Python/2.6/site-packages/Bcfg2/Server/Admin/Init.py", line 161, in create_conf e = sys.exc_info()[1] NameError: global name 'sys' is not defined
Adding "import sys" to the top of this file fixes the traceback for bcfg2-admin init but still errors out without making the /var/lib/bcfg2 repo and this error:
Warning: /etc/bcfg2.conf already exists. Overwrite? [y/N]: y Error global name 'keypath' is not defined occured while trying to write configuration file to '/etc/bcfg2.conf'.
Is this something to do with the PY3k work?
comment:3 Changed 12 years ago by rcuza
By "this file" I mean /Library/Python?/2.6/site-packages/Bcfg2/Server/Admin/Init.py.
comment:4 Changed 12 years ago by rcuza
And finally, /etc/bcfg2.conf was created but not /etc/bcfg2.key or /etc/bcfg2.crt.
Here is bcfg2.conf:
$ cat /etc/bcfg2.conf [server] repository = /var/lib/bcfg2 plugins = Base,Bundler,Cfg,Metadata,Pkgmgr,Rules,SSHbase [statistics] sendmailpath = /usr/lib/sendmail database_engine = sqlite3 # 'postgresql', 'mysql', 'mysql_old', 'sqlite3' or 'ado_mssql'. database_name = # Or path to database file if using sqlite3. #<repository>/etc/brpt.sqlite is default path if left empty database_user = # Not used with sqlite3. database_password = # Not used with sqlite3. database_host = # Not used with sqlite3. database_port = # Set to empty string for default. Not used with sqlite3. web_debug = True [communication] protocol = xmlrpc/ssl password = bestpasswdever certificate = /etc/bcfg2.crt key = /etc/bcfg2.key ca = /etc/bcfg2.crt [components] bcfg2 = https://localhost:6789
comment:5 Changed 12 years ago by rcuza
- Summary changed from Logging Traceback When bcfg2-server is Run With Incomplete Conf File and Missing /var/lib/bcfg2 Directory to Logging Traceback When bcfg2-server, bcfg2-lint, and bcfg2-admin are Run
comment:6 Changed 12 years ago by solj
- Owner changed from desai to solj
- Status changed from new to accepted
Can you try this and see if it fixes things:
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py index e69412a..71009b2 100644 --- a/src/lib/Server/Admin/Init.py +++ b/src/lib/Server/Admin/Init.py @@ -5,6 +5,7 @@ import socket import stat import string import subprocess +import sys import Bcfg2.Server.Admin import Bcfg2.Server.Plugin import Bcfg2.Options diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index ce08235..97238f4 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -5,6 +5,7 @@ import binascii import os import socket import shutil +import sys import tempfile from subprocess import Popen, PIPE import Bcfg2.Server.Plugin
bcfg2-ling gives the following traceback under the same conditions (regular user, same "broken" bcfg2.conf file: