Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
initialize correctly on disk
Browse files Browse the repository at this point in the history
  • Loading branch information
jsingle committed Sep 9, 2015
1 parent 6cbc250 commit 0212c62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dusty/commands/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ..log import log_to_client
from ..path import dir_modified_time, set_mac_user_ownership
from ..systems.docker.cleanup import remove_exited_dusty_containers, remove_images
from ..systems.virtualbox import get_docker_vm_disk_info, ensure_docker_vm_is_started
from ..systems.virtualbox import get_docker_vm_disk_info, ensure_docker_vm_is_started, initialize_docker_vm
from ..systems.rsync import sync_local_path_to_vm, sync_local_path_from_vm
from ..payload import daemon_command

Expand Down Expand Up @@ -41,7 +41,7 @@ def _ensure_backup_dir_exists(destination_path):
def backup(path):
destination_path = _full_destination_dir(path)
_ensure_backup_dir_exists(destination_path)
ensure_docker_vm_is_started()
initialize_docker_vm()
log_to_client("Syncing data from your VM to {}...".format(destination_path))
sync_local_path_from_vm(destination_path, constants.VM_PERSIST_DIR)
set_mac_user_ownership(destination_path)
Expand All @@ -51,6 +51,6 @@ def restore(source_path):
if not os.path.exists(source_path):
log_to_client("Can't find backup data to restore at {}".format(source_path))
return
ensure_docker_vm_is_started()
initialize_docker_vm()
log_to_client("Restoring your backup last modified at {}".format(dir_modified_time(source_path)))
sync_local_path_to_vm(source_path, constants.VM_PERSIST_DIR)
5 changes: 1 addition & 4 deletions dusty/systems/virtualbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ def _init_docker_vm():
check_call_demoted(['docker-machine', 'create'] + machine_options + [constants.VM_MACHINE_NAME],
redirect_stderr=True)

def _docker_vm_is_running():
return check_output_demoted(['docker-machine', 'status', constants.VM_MACHINE_NAME]).rstrip() == 'Running'

def _start_docker_vm():
"""Start the Dusty VM if it is not already running."""
if not _docker_vm_is_running():
if not docker_vm_is_running():
logging.info('Starting docker-machine VM {}'.format(constants.VM_MACHINE_NAME))
check_and_log_output_and_error_demoted(['docker-machine', 'start', constants.VM_MACHINE_NAME], quiet_on_success=True)

Expand Down

0 comments on commit 0212c62

Please sign in to comment.