summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin
diff options
context:
space:
mode:
authorJames Yang <jjyang@mcs.anl.gov>2009-06-30 20:31:14 +0000
committerJames Yang <jjyang@mcs.anl.gov>2009-06-30 20:31:14 +0000
commit8907fa0879422d1845813772765469b101fea216 (patch)
tree41b9dee619a559ba6c73f74c8a2aa948be13b632 /src/lib/Server/Admin
parente915a49930556f4e736775e4fe2d5ff1bf43dfdb (diff)
downloadbcfg2-8907fa0879422d1845813772765469b101fea216.tar.gz
bcfg2-8907fa0879422d1845813772765469b101fea216.tar.bz2
bcfg2-8907fa0879422d1845813772765469b101fea216.zip
Changed how bcfg2-admin init handles plugins and added update_client to metadata for changes in 5305
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5306 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Admin')
-rw-r--r--src/lib/Server/Admin/Init.py60
1 files changed, 45 insertions, 15 deletions
diff --git a/src/lib/Server/Admin/Init.py b/src/lib/Server/Admin/Init.py
index eddbb0b43..0930fa1f3 100644
--- a/src/lib/Server/Admin/Init.py
+++ b/src/lib/Server/Admin/Init.py
@@ -5,8 +5,16 @@ import socket
import string
import subprocess
import Bcfg2.Server.Admin
+import Bcfg2.Server.Plugin
import Bcfg2.Options
+from Bcfg2.Server.Plugins import (Account, Base, Bundler, Cfg,
+ Decisions, Deps, Metadata,
+ Packages, Pkgmgr, Probes,
+ Properties, Rules, Snapshots,
+ SSHbase, Svcmgr, TCheetah,
+ TGenshi)
+
# default config file
config = '''
[server]
@@ -171,19 +179,41 @@ class Init(Bcfg2.Server.Admin.Mode):
return
else:
# FIXME repo creation may fail as non-root user
- for subdir in ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules',
- 'etc', 'Metadata', 'Base', 'Bundler']:
- path = "%s/%s" % (repo, subdir)
- newpath = ''
- for subdir in path.split('/'):
- newpath = newpath + subdir + '/'
- try:
- os.mkdir(newpath)
- except:
- continue
-
- open("%s/Metadata/groups.xml" %
- repo, "w").write(groups % os_selection)
- open("%s/Metadata/clients.xml" %
- repo, "w").write(clients % socket.getfqdn())
+ plug_list = ['Account', 'Base', 'Bundler', 'Cfg',
+ 'Decisions', 'Deps', 'Metadata', 'Packages',
+ 'Pkgmgr', 'Probes', 'Properties', 'Rules',
+ 'Snapshots', 'SSHbase', 'Statistics', 'Svcmgr',
+ 'TCheetah', 'TGenshi']
+ default_repo = ['SSHbase', 'Cfg', 'Pkgmgr', 'Rules',
+ 'Metadata', 'Base', 'Bundler']
+ plugins = []
+ print 'Repository configuration, choose plugins:'
+ default = raw_input("Use default plugins? [Y/n]: ").lower()
+ if default == 'y' or default == '':
+ plugins = default_repo
+ else:
+ while True:
+ plugins_are_valid = True
+ plug_str = raw_input("Specify plugins: ")
+ plugins = plug_str.split(',')
+ for plugin in plugins:
+ plugin = plugin.strip()
+ if not plugin in plug_list:
+ plugins_are_valid = False
+ print "ERROR: plugin %s not recognized" % plugin
+ if plugins_are_valid:
+ break
+
+ path = "%s/%s" % (repo, 'etc')
+ newpath = ''
+ for subdir in path.split('/'):
+ newpath = newpath + subdir + '/'
+ try:
+ os.mkdir(newpath)
+ except:
+ continue
+
+ for plugin in plugins:
+ getattr(getattr(getattr(Bcfg2.Server.Plugins, plugin), plugin), 'init_repo')(repo)
+
print "Repository created successfuly in %s" % (self.repopath)