Browse Source

[2713] Use SYSCONFDIR for csv file

I know it's a different ticket but it seemed to easy not to do here

Also fixed a coupld of distcheck issues with .pyc files
Jelte Jansen 12 years ago
parent
commit
d5b8d3d8dd

+ 5 - 1
src/bin/usermgr/Makefile.am

@@ -4,7 +4,7 @@ sbin_SCRIPTS = b10-cmdctl-usermgr
 
 b10_cmdctl_usermgrdir = $(pkgdatadir)
 
-CLEANFILES=	b10-cmdctl-usermgr
+CLEANFILES=	b10-cmdctl-usermgr b10-cmdctl-usermgr.pyc
 
 man_MANS = b10-cmdctl-usermgr.8
 DISTCLEANFILES = $(man_MANS)
@@ -27,3 +27,7 @@ endif
 b10-cmdctl-usermgr: b10-cmdctl-usermgr.py
 	$(SED) "s|@@PYTHONPATH@@|@pyexecdir@|" b10-cmdctl-usermgr.py >$@
 	chmod a+x $@
+
+CLEANDIRS = __pycache__
+clean-local:
+	rm -rf $(CLEANDIRS)

+ 2 - 1
src/bin/usermgr/b10-cmdctl-usermgr.py.in

@@ -19,6 +19,7 @@
 This file implements user management program. The user name and
 its password is appended to csv file.
 '''
+from bind10_config import SYSCONFPATH
 import random
 from hashlib import sha1
 import csv
@@ -31,7 +32,7 @@ import isc.util.process
 isc.util.process.rename()
 
 VERSION_STRING = 'b10-cmdctl-usermgr @PACKAGE_VERSION@'
-DEFAULT_FILE = 'cmdctl-accounts.csv'
+DEFAULT_FILE = SYSCONFPATH + '/cmdctl-accounts.csv'
 
 class UserManager:
     def __init__(self, options):

+ 3 - 1
src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py

@@ -19,6 +19,7 @@ import imp
 import os
 import subprocess
 import unittest
+from bind10_config import SYSCONFPATH
 
 def run(command):
     """
@@ -155,7 +156,8 @@ Options:
         """
         # Hardcoded path .. should be ok since this is run from make check
         usermgr = imp.load_source('usermgr', '../b10-cmdctl-usermgr.py')
-        self.assertEqual('cmdctl-accounts.csv', usermgr.DEFAULT_FILE)
+        self.assertEqual(SYSCONFPATH + '/cmdctl-accounts.csv',
+                         usermgr.DEFAULT_FILE)
 
 if __name__== '__main__':
     unittest.main()

+ 2 - 0
src/lib/python/bind10_config.py.in

@@ -24,11 +24,13 @@ def reload():
     global PLUGIN_PATHS
     global PREFIX
     global LIBEXECPATH
+    global SYSCONFPATH
     BIND10_MSGQ_SOCKET_FILE = os.path.join("@localstatedir@",
                                            "@PACKAGE_NAME@",
                                            "msgq_socket").replace("${prefix}",
                                                                   "@prefix@")
     PREFIX = "@prefix@"
+    SYSCONFPATH="@sysconfdir@/@PACKAGE@".replace('${prefix}', PREFIX)
 
     # B10_FROM_SOURCE is set in the environment for internal tests and
     # an experimental run without installagion.  In that case we need to