|
From: <di...@us...> - 2007-03-06 04:11:29
|
Revision: 430
http://safekeep.svn.sourceforge.net/safekeep/?rev=430&view=rev
Author: dimi
Date: 2007-03-05 20:11:28 -0800 (Mon, 05 Mar 2007)
Log Message:
-----------
Add (partial) support for a global configuration file:
/etc/safekeep/safekeep.conf
Allow the -c/--conf switch to take both global conf
file and client conf files as parameters.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2007-03-04 20:15:32 UTC (rev 429)
+++ safekeep/trunk/safekeep 2007-03-06 04:11:28 UTC (rev 430)
@@ -5,7 +5,7 @@
import xml.dom.minidom
import socket, smtplib
-config_dir = '/etc/safekeep/clients.d'
+config_dir = '/etc/safekeep'
config_ext = '.backup'
logbuf = []
is_client = False
@@ -784,6 +784,7 @@
mode = None
email = []
smtp = ''
+ cfgfile = None
cfglocs = []
verbosity = 0
clientid = None
@@ -792,7 +793,13 @@
keys_deploy = None
for o, a in opts:
if o in ('-c', '--conf'):
- cfglocs.append(a)
+ if os.path.isdir(a) or a.endswith(config_ext):
+ cfglocs.append(a)
+ elif cfgfile is None:
+ cfgfile = a
+ else:
+ error('A main configuration file can be specified only once!')
+ sys.exit(2)
elif o in ('-e', '--email'):
email.append(a)
elif o in ('-h', '--help'):
@@ -834,9 +841,14 @@
if mode is 'client' and cfglocs:
usage(2)
- if mode is not 'client' and len(cfglocs) == 0:
- cfglocs.append(config_dir)
- cfgs = parse_locs(cfglocs)
+ if mode is not 'client':
+ if cfgfile is None:
+ cfgfile = os.path.join(config_dir, 'safekeep.conf')
+ # FIXME: parse config file
+ if len(cfglocs) == 0:
+ locs = os.path.join(config_dir, 'clients.d')
+ cfglocs.append(locs)
+ cfgs = parse_locs(cfglocs)
if mode is 'client':
if len(args) > 0: usage(2)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|