summaryrefslogtreecommitdiffstats
path: root/ipa-radius-server
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2007-12-13 09:31:28 +0000
committerMark McLoughlin <markmc@redhat.com>2007-12-13 09:31:28 +0000
commit6976f92862c1dba3f7a25baa1893c41a67590b23 (patch)
tree4d9f2e1a526c586b4fa43d00b84aad5e348f742b /ipa-radius-server
parentc049d2d8218dc5c560f9692397af91cac2559edd (diff)
downloadfreeipa-6976f92862c1dba3f7a25baa1893c41a67590b23.tar.gz
freeipa-6976f92862c1dba3f7a25baa1893c41a67590b23.tar.xz
freeipa-6976f92862c1dba3f7a25baa1893c41a67590b23.zip
Refactor krbinstance and dsinstance creation steps
Creation steps are currently done with: self.start_creation(2, "Create foo") self.step("do foo") self.foo() self.step("do bar") self.bar() self.done_creation() This patch refactors that into the much more straightforward: self.step("do foo", self.foo) self.step("do bar", self.bar) self.start_creation("Create foo") Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'ipa-radius-server')
-rw-r--r--ipa-radius-server/plugins/radiusinstance.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/ipa-radius-server/plugins/radiusinstance.py b/ipa-radius-server/plugins/radiusinstance.py
index 2d68adf7..731cd65a 100644
--- a/ipa-radius-server/plugins/radiusinstance.py
+++ b/ipa-radius-server/plugins/radiusinstance.py
@@ -79,7 +79,6 @@ class RadiusInstance(service.Service):
self.basedn = self.suffix
self.user_basedn = "%s,%s" % (DefaultUserContainer, self.basedn) # FIXME, should be utility to get this
self.radius_version = get_radius_version()
- self.start_creation(4, "Configuring radiusd")
try:
self.stop()
@@ -87,22 +86,23 @@ class RadiusInstance(service.Service):
# It could have been not running
pass
- self.__create_radius_keytab()
- self.__radiusd_conf()
+ self.step("create radiusd keytab", self.__create_radius_keytab)
+ self.step("configuring radiusd.conf for radius instance", self.__radiusd_conf)
+ self.step("starting radiusd", self.__start_instance)
+ self.step("configuring radiusd to start on boot", self.chkconfig_on)
+ # FIXME:
+ # self.step("setting ldap encrypted attributes", self.__set_ldap_encrypted_attributes)
+
+ self.start_creation("Configuring radiusd")
+
+ def __start_instance(self):
try:
- self.step("starting radiusd")
self.start()
except:
logging.error("radiusd service failed to start")
- self.step("configuring radiusd to start on boot")
- self.chkconfig_on()
-
-
def __radiusd_conf(self):
- self.step('configuring radiusd.conf for radius instance')
-
version = 'IPA_RADIUS_VERSION=%s FREE_RADIUS_VERSION=%s' % (IPA_RADIUS_VERSION, self.radius_version)
sub_dict = {'CONFIG_FILE_VERSION_INFO' : version,
'LDAP_SERVER' : self.ldap_server,
@@ -123,7 +123,6 @@ class RadiusInstance(service.Service):
logging.error("could not create %s: %s", radius_util.RADIUSD_CONF_FILEPATH, e)
def __create_radius_keytab(self):
- self.step("creating a keytab for radiusd")
try:
if ipautil.file_exists(radius_util.RADIUS_IPA_KEYTAB_FILEPATH):
os.remove(radius_util.RADIUS_IPA_KEYTAB_FILEPATH)
@@ -153,9 +152,7 @@ class RadiusInstance(service.Service):
except Exception, e:
logging.error("could not chown on %s to %s: %s", radius_util.RADIUS_IPA_KEYTAB_FILEPATH, radius_util.RADIUS_USER, e)
- def __ldap_mod(self, step, ldif):
- self.step(step)
-
+ def __ldap_mod(self, ldif):
txt = iputil.template_file(ipautil.SHARE_DIR + ldif, self.sub_dict)
fd = ipautil.write_tmp_file(txt)
@@ -171,8 +168,7 @@ class RadiusInstance(service.Service):
#FIXME, should use IPAdmin method
def __set_ldap_encrypted_attributes(self):
- self.__ldap_mod("setting ldap encrypted attributes",
- "encrypted_attribute.ldif", {"ENCRYPTED_ATTRIBUTE" : "radiusClientSecret"})
+ self.__ldap_mod("encrypted_attribute.ldif", {"ENCRYPTED_ATTRIBUTE" : "radiusClientSecret"})
#-------------------------------------------------------------------------------