- # Build a schema file in Fedora DS format
- backend_schema_data = schema.ldb.convert_schema_to_openldap("fedora-ds", open(setup_path(mapping), 'r').read())
- assert backend_schema_data is not None
- open(os.path.join(result.paths.ldapdir, backend_schema), 'w').write(backend_schema_data)
-
- result.credentials.set_bind_dn(names.ldapmanagerdn)
-
- # Destory the target directory, or else setup-ds.pl will complain
- fedora_ds_dir = os.path.join(result.paths.ldapdir, "slapd-samba4")
- shutil.rmtree(fedora_ds_dir, True)
-
- result.slapd_provision_command = [slapd_path, "-D", fedora_ds_dir, "-i", result.paths.slapdpid];
- #In the 'provision' command line, stay in the foreground so we can easily kill it
- result.slapd_provision_command.append("-d0")
-
- #the command for the final run is the normal script
- result.slapd_command = [os.path.join(result.paths.ldapdir, "slapd-samba4", "start-slapd")]
-
- # If we were just looking for crashes up to this point, it's a
- # good time to exit before we realise we don't have Fedora DS on
- if ldap_dryrun_mode:
- sys.exit(0)
-
- # Try to print helpful messages when the user has not specified the path to the setup-ds tool
- if setup_ds_path is None:
- raise ProvisioningError("Warning: Fedora DS LDAP-Backend must be setup with path to setup-ds, e.g. --setup-ds-path=\"/usr/sbin/setup-ds.pl\"!")
- if not os.path.exists(setup_ds_path):
- message (setup_ds_path)
- raise ProvisioningError("Warning: Given Path to slapd does not exist!")
-
- # Run the Fedora DS setup utility
- retcode = subprocess.call([setup_ds_path, "--silent", "--file", result.paths.fedoradsinf], close_fds=True, shell=False)
- if retcode != 0:
- raise ProvisioningError("setup-ds failed")
+ # Build a schema file in Fedora DS format
+ backend_schema_data = self.schema.ldb.convert_schema_to_openldap("fedora-ds", open(self.setup_path(mapping), 'r').read())
+ assert backend_schema_data is not None
+ open(os.path.join(self.paths.ldapdir, backend_schema), 'w').write(backend_schema_data)
+
+ self.credentials.set_bind_dn(self.names.ldapmanagerdn)
+
+ # Destory the target directory, or else setup-ds.pl will complain
+ fedora_ds_dir = os.path.join(self.paths.ldapdir, "slapd-samba4")
+ shutil.rmtree(fedora_ds_dir, True)
+
+ self.slapd_provision_command = [self.slapd_path, "-D", fedora_ds_dir, "-i", self.paths.slapdpid];
+ #In the 'provision' command line, stay in the foreground so we can easily kill it
+ self.slapd_provision_command.append("-d0")
+
+ #the command for the final run is the normal script
+ self.slapd_command = [os.path.join(self.paths.ldapdir, "slapd-samba4", "start-slapd")]
+
+ # If we were just looking for crashes up to this point, it's a
+ # good time to exit before we realise we don't have Fedora DS on
+ if self.ldap_dryrun_mode:
+ sys.exit(0)
+
+ # Try to print helpful messages when the user has not specified the path to the setup-ds tool
+ if self.setup_ds_path is None:
+ raise ProvisioningError("Warning: Fedora DS LDAP-Backend must be setup with path to setup-ds, e.g. --setup-ds-path=\"/usr/sbin/setup-ds.pl\"!")
+ if not os.path.exists(self.setup_ds_path):
+ self.message (self.setup_ds_path)
+ raise ProvisioningError("Warning: Given Path to slapd does not exist!")