Skip to content

Commit

Permalink
Check if mountpoint given before mount command
Browse files Browse the repository at this point in the history
Fixes "index out of range" error if no mountpoint
was given.
  • Loading branch information
johnramsden committed Jun 10, 2018
1 parent 13c4850 commit 69e99bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zedenv/cli/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def zedenv_mount(boot_environment: str, mountpoint: Optional[str], verbose: bool
help="Print verbose output.")
@click.argument('boot_environment')
@click.argument('mountpoint', nargs=-1, required=False)
def cli(boot_environment: str, mountpoint: Optional[str], verbose: Optional[bool]):
def cli(boot_environment: str, mountpoint: Optional[list], verbose: Optional[bool]):
try:
zedenv.lib.check.startup_check()
except RuntimeError as err:
Expand All @@ -141,4 +141,6 @@ def cli(boot_environment: str, mountpoint: Optional[str], verbose: Optional[bool
"message": f"Dataset already mounted to {dataset_mountpoint}\n"
}, exit_on_error=True)

zedenv_mount(boot_environment, mountpoint[0], verbose, be_root)
real_mountpoint = mountpoint[0] if mountpoint else None

zedenv_mount(boot_environment, real_mountpoint, verbose, be_root)

0 comments on commit 69e99bd

Please sign in to comment.