Skip to content

Commit

Permalink
Fix: drakplayground missing import after refactoring (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 authored Jul 22, 2024
1 parent afb51c4 commit 6e4f751
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 2 additions & 6 deletions drakrun/drakrun/draksetup/mount.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import os
import subprocess

import click

from drakrun.lib.bindings.xen import xen_insert_cd
from drakrun.lib.vm import FIRST_CDROM_DRIVE


def insert_cd(domain, drive, iso):
subprocess.run(["xl", "cd-insert", domain, drive, iso], check=True)


@click.command(help="Mount ISO into guest", no_args_is_help=True)
@click.argument("iso_path", type=click.Path(exists=True))
@click.option(
Expand All @@ -25,4 +21,4 @@ def mount(iso_path, domain_name):
Domain can be retrieved by running "xl list" command on the host.
"""
iso_path_full = os.path.abspath(iso_path)
insert_cd(domain_name, FIRST_CDROM_DRIVE, iso_path_full)
xen_insert_cd(domain_name, FIRST_CDROM_DRIVE, iso_path_full)
4 changes: 4 additions & 0 deletions drakrun/drakrun/lib/bindings/xen.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ def get_xen_info() -> Dict[str, str]:
k, v = k.strip(), v.strip()
elements[k] = v
return elements


def xen_insert_cd(domain, drive, iso):
subprocess.run(["xl", "cd-insert", domain, drive, iso], check=True)
4 changes: 2 additions & 2 deletions drakrun/drakrun/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from IPython import embed

from drakrun.draksetup import insert_cd
from drakrun.lib.bindings.xen import xen_insert_cd
from drakrun.lib.injector import Injector
from drakrun.lib.install_info import InstallInfo
from drakrun.lib.networking import (
Expand Down Expand Up @@ -136,7 +136,7 @@ def copy(self, local):

def mount(self, local_iso_path, drive=FIRST_CDROM_DRIVE):
local_iso_path = Path(local_iso_path)
insert_cd(self.vm.vm_name, drive, local_iso_path)
xen_insert_cd(self.vm.vm_name, drive, local_iso_path)

def run(self, cmd):
self.injector.create_process(cmd)
Expand Down

0 comments on commit 6e4f751

Please sign in to comment.