Skip to content

Commit

Permalink
mount dir fuctionality
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil Dhandre <ndhandre@redhat.com>
  • Loading branch information
digitronik committed Jul 21, 2019
1 parent 10b66a4 commit 9a5e011
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion miqsel/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ container:
project: null
server_port: 4444
vnc_port: 5999
data_dir: null
data_dir: None
miq:
appliances:
- hostname: null
Expand Down
5 changes: 4 additions & 1 deletion miqsel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def config():
cfg = conf.read()

cfg["container"]["project"] = click.prompt(
"Miq project working dir", default=cfg["container"]["project"]
"Miq project working directory", default=cfg["container"]["project"]
)
cfg["container"]["name"] = click.prompt("Container name", default=cfg["container"]["name"])
cfg["container"]["image"] = click.prompt(
Expand All @@ -41,5 +41,8 @@ def config():
cfg["container"]["server_port"] = click.prompt(
"Selenium server running on port?", default=cfg["container"]["server_port"]
)
cfg["container"]["data_dir"] = click.prompt(
"Extra data mount directory to '/urs/tmp'", default=cfg["container"]["data_dir"]
)
conf.write(cfg=cfg)
click.echo("Configuration saved successfully...")
9 changes: 7 additions & 2 deletions miqsel/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,23 @@ def vnc(self):
else None
)

def start(self):
def start(self, **kwargs):
"""Start selenium container"""

img = self.cfg["container"]["image"]
name = self.cfg["container"]["name"]
mount_dir = self.cfg["container"]["data_dir"]

if mount_dir != "None":
kwargs.update({"volumes": {mount_dir: {"bind": "/usr/tmp", "mode": "ro"}}})

if not self.container:
if not self.client.images.list(name=img):
click.echo("Pulling docker images...")
click.echo("It will take some time; Please wait...")

self.client.containers.run(img, name=name, detach=True, auto_remove=True)
self.client.containers.run(img, name=name, detach=True, auto_remove=True, **kwargs)

time.sleep(5)

t0 = time.time()
Expand Down

0 comments on commit 9a5e011

Please sign in to comment.