vbox: Make guest additions path relative to manifest

This commit is contained in:
Anders Ingemann 2017-07-14 18:27:16 +02:00
parent ff48243c6e
commit bf7525426b
No known key found for this signature in database
GPG key ID: 49C87973A14931A9
2 changed files with 4 additions and 7 deletions

View file

@ -7,7 +7,8 @@ properties:
type: object type: object
properties: properties:
guest_additions: guest_additions:
$ref: '#/definitions/absolute_path' type: string
pattern: ^[^\0]+$
system: system:
type: object type: object
properties: properties:
@ -35,7 +36,3 @@ properties:
- msdos - msdos
- gpt - gpt
required: [backing] required: [backing]
definitions:
absolute_path:
type: string
pattern: ^/[^\0]+$

View file

@ -14,7 +14,7 @@ class CheckGuestAdditionsPath(Task):
@classmethod @classmethod
def run(cls, info): def run(cls, info):
guest_additions_path = info.manifest.provider['guest_additions'] guest_additions_path = rel_path(info.manifest.path, info.manifest.provider['guest_additions'])
if not os.path.exists(guest_additions_path): if not os.path.exists(guest_additions_path):
msg = 'The file {file} does not exist.'.format(file=guest_additions_path) msg = 'The file {file} does not exist.'.format(file=guest_additions_path)
raise TaskError(msg) raise TaskError(msg)
@ -58,7 +58,7 @@ class InstallGuestAdditions(Task):
kernel_version = value.strip().split('linux-headers-')[-1] kernel_version = value.strip().split('linux-headers-')[-1]
break break
guest_additions_path = info.manifest.provider['guest_additions'] guest_additions_path = rel_path(info.manifest.path, info.manifest.provider['guest_additions'])
mount_dir = 'mnt/guest_additions' mount_dir = 'mnt/guest_additions'
mount_path = os.path.join(info.root, mount_dir) mount_path = os.path.join(info.root, mount_dir)
os.mkdir(mount_path) os.mkdir(mount_path)