diff options
| author | Ade Lee <alee@redhat.com> | 2014-04-15 14:09:32 -0400 |
|---|---|---|
| committer | Ade Lee <alee@redhat.com> | 2014-05-27 14:51:50 -0400 |
| commit | 900de7d04f6a1fe2f71d310ccddbc2a5b89c81dc (patch) | |
| tree | 7a6c3af8aebb9461bdf65acca48a88434c09ff7f /ipaserver/install/installutils.py | |
| parent | c8a824c850dd20012a233ae9fbcf47775e05801b (diff) | |
| download | freeipa-900de7d04f6a1fe2f71d310ccddbc2a5b89c81dc.tar.gz freeipa-900de7d04f6a1fe2f71d310ccddbc2a5b89c81dc.tar.xz freeipa-900de7d04f6a1fe2f71d310ccddbc2a5b89c81dc.zip | |
Added ipa-drm-install
ipa-drm-install can be used (with no arguments) to
add a DRM to an existing ipa instance that already contains
a Dogtag CA.
In a subsequent patch, I will add logic to this script to
detect if a drm naming context exists, and if so, to look for
a replica file for installing on a replica.
Diffstat (limited to 'ipaserver/install/installutils.py')
| -rw-r--r-- | ipaserver/install/installutils.py | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 32cf6bb70..e2d785881 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -40,8 +40,7 @@ from ipapython.ipa_log_manager import * from ipalib.util import validate_hostname from ipapython import config from ipalib import errors -from ipapython.dn import DN -from ipaserver.install import certs, service +from ipaserver.install import certs from ipapython import services as ipaservices # Used to determine install status @@ -172,7 +171,7 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True): raise HostReverseLookupError("The host name %s does not match the reverse lookup %s" % (host_name, revname)) verified.add(address) -def record_in_hosts(ip, host_name=None, file="/etc/hosts"): +def record_in_hosts(ip, host_name=None, conf_file="/etc/hosts"): """ Search record in /etc/hosts - static table lookup for hostnames @@ -182,9 +181,9 @@ def record_in_hosts(ip, host_name=None, file="/etc/hosts"): :param ip: IP address :param host_name: Optional hostname to search - :param file: Optional path to the lookup table + :param conf_file: Optional path to the lookup table """ - hosts = open(file, 'r').readlines() + hosts = open(conf_file, 'r').readlines() for line in hosts: line = line.rstrip('\n') fields = line.partition('#')[0].split() @@ -204,13 +203,13 @@ def record_in_hosts(ip, host_name=None, file="/etc/hosts"): return None return (hosts_ip, names) except IndexError: - print "Warning: Erroneous line '%s' in %s" % (line, file) + print "Warning: Erroneous line '%s' in %s" % (line, conf_file) continue return None -def add_record_to_hosts(ip, host_name, file="/etc/hosts"): - hosts_fd = open(file, 'r+') +def add_record_to_hosts(ip, host_name, conf_file="/etc/hosts"): + hosts_fd = open(conf_file, 'r+') hosts_fd.seek(0, 2) hosts_fd.write(ip+'\t'+host_name+' '+host_name.split('.')[0]+'\n') hosts_fd.close() @@ -510,20 +509,20 @@ def expand_replica_info(filename, password): """ top_dir = tempfile.mkdtemp("ipa") tarfile = top_dir+"/files.tar" - dir = top_dir + "/realm_info" + dir_path = top_dir + "/realm_info" ipautil.decrypt_file(filename, tarfile, password, top_dir) ipautil.run(["tar", "xf", tarfile, "-C", top_dir]) os.remove(tarfile) - return top_dir, dir + return top_dir, dir_path -def read_replica_info(dir, rconfig): +def read_replica_info(dir_path, rconfig): """ Read the contents of a replica installation file. rconfig is a ReplicaConfig object """ - filename = dir + "/realm_info" + filename = dir_path + "/realm_info" fd = open(filename) config = SafeConfigParser() config.readfp(fd) @@ -779,7 +778,7 @@ def check_pkcs12(pkcs12_info, ca_file, hostname): raise ScriptError( '%s server certificates found in %s, expecting only one' % (len(server_certs), pkcs12_filename)) - [(server_cert_name, server_cert_trust)] = server_certs + [(server_cert_name, _server_cert_trust)] = server_certs # Check we have the whole cert chain & the CA is in it trust_chain = nssdb.get_trust_chain(server_cert_name) @@ -863,21 +862,3 @@ def stopped_service(service, instance_name=""): finally: root_logger.debug('Starting %s%s.', service, log_instance_name) ipaservices.knownservices[service].start(instance_name) - -def check_entropy(): - ''' - Checks if the system has enough entropy, if not, displays warning message - ''' - try: - with open('/proc/sys/kernel/random/entropy_avail', 'r') as efname: - if int(efname.read()) < 200: - emsg = 'WARNING: Your system is running out of entropy, ' \ - 'you may experience long delays' - service.print_msg(emsg) - root_logger.debug(emsg) - except IOError as e: - root_logger.debug("Could not open /proc/sys/kernel/random/entropy_avail: %s" % \ - e) - except ValueError as e: - root_logger.debug("Invalid value in /proc/sys/kernel/random/entropy_avail %s" % \ - e) |
