From cd8fd312c1463aab564a5d811ef92b1e3d938c7a Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 15 Mar 2013 12:32:23 -0400 Subject: init: fixed creation of repo directory for real this time --- src/lib/Bcfg2/Server/Admin/Init.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/lib/Bcfg2/Server/Admin/Init.py b/src/lib/Bcfg2/Server/Admin/Init.py index 48fa89498..3e642ee49 100644 --- a/src/lib/Bcfg2/Server/Admin/Init.py +++ b/src/lib/Bcfg2/Server/Admin/Init.py @@ -221,7 +221,6 @@ class Init(Bcfg2.Server.Admin.Mode): if response.lower().strip() == 'y': break else: - os.makedirs(self.data['repopath']) break def _prompt_password(self): @@ -319,6 +318,16 @@ class Init(Bcfg2.Server.Admin.Mode): def init_repo(self): """Setup a new repo and create the content of the configuration file.""" + # Create the repository + path = os.path.join(self.data['repopath'], 'etc') + try: + os.makedirs(path) + self._init_plugins() + print("Repository created successfuly in %s" % + self.data['repopath']) + except OSError: + print("Failed to create %s." % path) + confdata = CONFIG % (self.data['repopath'], ','.join(self.plugins), self.data['sendmail'], @@ -334,13 +343,3 @@ class Init(Bcfg2.Server.Admin.Mode): create_key(self.data['shostname'], self.data['keypath'], self.data['certpath'], self.data['country'], self.data['state'], self.data['location']) - - # Create the repository - path = os.path.join(self.data['repopath'], 'etc') - try: - os.makedirs(path) - self._init_plugins() - print("Repository created successfuly in %s" % - self.data['repopath']) - except OSError: - print("Failed to create %s." % path) -- cgit v1.2.3-1-g7c22