def figureDEFS_dirs(options): """ figure out the directory defaults (after options being at least parsed once). """ global DEFS ## fix up the --dir setting DEFS["--dir"] = getOption(options, "dir") or DEFS["--dir"] or "." DEFS["--dir"] = cleanupNormPath(DEFS["--dir"], dotYN=1) ## fix up the --set-hostname and MACHINENAME settings DEFS["--set-hostname"] = getOption(options, "set_hostname") or DEFS["--set-hostname"] or socket.gethostname() global MACHINENAME MACHINENAME = getMachineName(DEFS["--set-hostname"]) ## remap to options object setOption(options, "dir", DEFS["--dir"]) setOption(options, "set_hostname", DEFS["--set-hostname"])
def figureDEFS_dirs(options): """ figure out the directory defaults (after options being at least parsed once). """ global DEFS ## fix up the --dir setting DEFS['--dir'] = getOption(options, 'dir') or DEFS['--dir'] or '.' DEFS['--dir'] = cleanupNormPath(DEFS['--dir'], dotYN=1) ## fix up the --set-hostname and MACHINENAME settings DEFS['--set-hostname'] = getOption(options, 'set_hostname') \ or DEFS['--set-hostname'] \ or socket.gethostname() global MACHINENAME MACHINENAME = getMachineName(DEFS['--set-hostname']) ## remap to options object setOption(options, 'dir', DEFS['--dir']) setOption(options, 'set_hostname', DEFS['--set-hostname'])
## language imports import os import sys import copy import time import socket import string ## local imports from spacewalk.common.fileutils import cleanupNormPath, rotateFile, rhn_popen, cleanupAbsPath from sslToolLib import getMachineName, daysTil18Jan2038, incSerial, fixSerial # defaults where we can see them (NOTE: directory is figured at write time) CERT_PATH = '/usr/share/rhn/certs/' BUILD_DIR = cleanupNormPath('./ssl-build', dotYN=1) HOSTNAME = socket.gethostname() MACHINENAME = getMachineName(HOSTNAME) CA_KEY_NAME = 'RHN-ORG-PRIVATE-SSL-KEY' CA_CRT_NAME = 'RHN-ORG-TRUSTED-SSL-CERT' CA_CRT_RPM_NAME = string.lower(CA_CRT_NAME) BASE_SERVER_RPM_NAME = 'rhn-org-httpd-ssl-key-pair' BASE_SERVER_TAR_NAME = 'rhn-org-httpd-ssl-archive' LEGACY_CA_KEY_NAME = 'ca.key' LEGACY_CA_CRT_NAME = 'RHNS-CORP-CA-CERT' LEGACY_SERVER_RPM_NAME1 = 'rhns-ssl-cert' LEGACY_SERVER_RPM_NAME2 = 'rhn-httpd-ssl-key-pair' LEGACY_CA_CERT_RPM_NAME = 'rhns-ca-cert'
import copy import time import socket import string ## local imports from spacewalk.common.fileutils import cleanupNormPath, rotateFile, rhn_popen, cleanupAbsPath from sslToolLib import getMachineName, daysTil18Jan2038, incSerial, fixSerial # defaults where we can see them (NOTE: directory is figured at write time) CERT_PATH = "/usr/share/rhn/certs/" if not os.path.exists(CERT_PATH): # v3.4.0 and older CERT_PATH = "/var/www/rhns/certs/" BUILD_DIR = cleanupNormPath("./ssl-build", dotYN=1) HOSTNAME = socket.gethostname() MACHINENAME = getMachineName(HOSTNAME) CA_KEY_NAME = "RHN-ORG-PRIVATE-SSL-KEY" CA_CRT_NAME = "RHN-ORG-TRUSTED-SSL-CERT" CA_CRT_RPM_NAME = string.lower(CA_CRT_NAME) BASE_SERVER_RPM_NAME = "rhn-org-httpd-ssl-key-pair" BASE_SERVER_TAR_NAME = "rhn-org-httpd-ssl-archive" LEGACY_CA_KEY_NAME = "ca.key" LEGACY_CA_CRT_NAME = "RHNS-CORP-CA-CERT" LEGACY_SERVER_RPM_NAME1 = "rhns-ssl-cert" LEGACY_SERVER_RPM_NAME2 = "rhn-httpd-ssl-key-pair" LEGACY_CA_CERT_RPM_NAME = "rhns-ca-cert"