Example #1
0
def create_iso_image(iso_path, content_path, label=constants.PRODUCT_NAME):
    if os.path.exists(iso_path):
        os.remove(iso_path)

    normalized_path = content_path.replace("\\", "/")
    mkisofs = os.path.join(utils.get_bin_dir(), "mkisofs.exe")
    utils.execute_process([
        mkisofs, '-o', iso_path, '-ldots', '-allow-lowercase',
        '-allow-multidot', '-l', '-publisher', constants.PRODUCT_NAME,
        '-quiet', '-J', '-r', '-V', label, normalized_path
    ])
Example #2
0
def generate_ssh_key(key_path, key_type="rsa", key_bits=2048):
    _ensure_dir(key_path)

    if os.path.exists(key_path):
        os.remove(key_path)

    pub_key_path = "%s.pub" % key_path
    if os.path.exists(pub_key_path):
        os.remove(pub_key_path)

    ssh_keygen_bin = os.path.join(utils.get_bin_dir(), "ssh-keygen.exe")
    (out, err) = utils.execute_process([
        ssh_keygen_bin, "-t", key_type, "-b",
        str(key_bits), "-N", "", "-C",
        "%s controller" % constants.PRODUCT_NAME, "-f", key_path
    ])
    LOG.debug("ssh-keygen output: %s" % out)

    return (key_path, pub_key_path)
Example #3
0
    def open_controller_ssh(self, host_address):
        key_path = self._get_controller_ssh_key_path()

        ssh_user = "******"
        bin_dir = utils.get_bin_dir()
        ssh_path = os.path.join(bin_dir, "ssh.exe")
        title = "V-Magine - OpenStack SSH Console"

        encoded_cmd = self._get_powershell_encoded_cmd(
            '$host.ui.RawUI.WindowTitle = "%(title)s"; '
            '& "%(ssh_path)s" -o StrictHostKeyChecking=no -i "%(key_path)s" '
            '%(user)s@%(host)s -t bash --rcfile keystonerc_admin -i' % {
                "title": title,
                "ssh_path": ssh_path,
                "key_path": key_path,
                "user": ssh_user,
                "host": host_address
            })

        self._windows_utils.run_safe_process(self._get_powershell_path(),
                                             "-EncodedCommand %s" %
                                             encoded_cmd,
                                             new_console=True)
Example #4
0
def _get_openssl_bin():
    return os.path.join(utils.get_bin_dir(), "openssl.exe")
Example #5
0
def _get_mtools_dir():
    return utils.get_bin_dir()