Skip to content

Commit

Permalink
Merge pull request #781 from saurabh6790/vm_fixes
Browse files Browse the repository at this point in the history
Vm fixes
  • Loading branch information
saurabh6790 authored Mar 7, 2019
2 parents 192c343 + f7a095b commit 3dbb412
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions vm/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def install_virtualbox():
check_output(['bench', 'install', 'virtualbox'])

def install_packer():
if not os.path.exists(os.path.join('/', 'opt', 'packer')):
if not spawn.find_executable("packer") or not os.path.exists(os.path.join('/', 'opt', 'packer')):
check_output(['bench', 'install', 'packer'])

def silent_remove(name, is_dir=False):
'''
Method to safely remove a file or directory,
without throwing error if file doesn't exist
By default takes in file as input, for directory:
is_dir = True
'''
Expand All @@ -59,8 +59,8 @@ def cleanup():
silent_remove("packer_virtualbox-iso_virtualbox-iso_md5.checksum")

def build_vm():
check_output(["/opt/packer", "build", "vm-production.json"])
check_output(["/opt/packer", "build", "vm-develop.json"])
check_output(["packer", "build", "vm-production.json"])
check_output(["packer", "build", "vm-develop.json"])

def md5(build, file):
return check_output("md5sum '{} Builds/{}'".format(build, file), shell=True).split()[0]
Expand Down Expand Up @@ -116,7 +116,7 @@ def delete_old_vms():
silent_remove(os.path.join(PUBLIC_DIR, 'BACKUPS'), is_dir=True)

def move_current_vms():
os.mkdir(os.path.join(PUBLIC_DIR, 'BACKUPS'))
os.mkdir(os.path.join(PUBLIC_DIR, 'BACKUPS'))
for file in os.listdir(PUBLIC_DIR):
if file in NEW_FILES or file in SYMLINKS or file == 'BACKUPS':
continue
Expand Down
4 changes: 2 additions & 2 deletions vm/vm-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"format": "ova",
"guest_os_type": "Ubuntu_64",
"headless": true,
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso",
"iso_checksum": "6a7f31eb125a0b2908cf2333d7777c82",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-amd64.iso",
"iso_checksum": "ac8a79a86a905ebdc3ef3f5dd16b7360",
"iso_checksum_type": "md5",
"ssh_username": "frappe",
"ssh_password": "frappe",
Expand Down
4 changes: 2 additions & 2 deletions vm/vm-production.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"format": "ova",
"guest_os_type": "Ubuntu_64",
"headless": true,
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso",
"iso_checksum": "6a7f31eb125a0b2908cf2333d7777c82",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-amd64.iso",
"iso_checksum": "ac8a79a86a905ebdc3ef3f5dd16b7360",
"iso_checksum_type": "md5",
"ssh_username": "frappe",
"ssh_password": "frappe",
Expand Down

0 comments on commit 3dbb412

Please sign in to comment.