def figureDEFS_dirs(options):
    """ figure out the directory defaults (after options being at least parsed
        once).
    """

    # 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 = DEFS['--set-hostname']

    # remap to options object
    setOption(options, 'dir', DEFS['--dir'])
    setOption(options, 'set_hostname', DEFS['--set-hostname'])
from __future__ import print_function

# language imports
import os
import sys
import copy
import time
import socket

# local imports
from katello_certs_tools.fileutils import cleanupNormPath, rotateFile, rhn_popen, cleanupAbsPath
from katello_certs_tools.sslToolLib import daysTil18Jan2038, incSerial, fixSerial

# defaults where we can see them (NOTE: directory is figured at write time)
CERT_PATH = '/etc/pki/katello-certs-tools'
BUILD_DIR = cleanupNormPath('./ssl-build', dotYN=1)
HOSTNAME = socket.gethostname()
MACHINENAME = HOSTNAME

CA_KEY_NAME = 'KATELLO-PRIVATE-SSL-KEY'
CA_CRT_NAME = 'KATELLO-TRUSTED-SSL-CERT'
CA_CRT_RPM_NAME = CA_CRT_NAME.lower()

BASE_SERVER_RPM_NAME = 'katello-httpd-ssl-key-pair'
BASE_SERVER_TAR_NAME = 'katello-httpd-ssl-archive'

CA_OPENSSL_CNF_NAME = 'katello-ca-openssl.cnf'
SERVER_OPENSSL_CNF_NAME = 'katello-server-openssl.cnf'

MD = 'sha256'
CRYPTO = '-des3'