Exemple #1
0
    def install_guest_additions(self):
        """
        Installs guest additions into the VM.
        """
        log.info('Installing guest additions...')

        manage.load_dvd(self._vbox.name, manage.guest_additions_iso)

        mount_point = '/media/cdrom'

        sudo(clom.mkdir(mount_point, p=True))

        with settings(warn_only=True):
            r = sudo(clom.mountpoint(mount_point))
        if r.return_code == 0:
            sudo(clom.umount(mount_point))

        sudo(clom.mount('/dev/cdrom', mount_point))

        with cd(mount_point):
            sudo(clom.sh('VBoxLinuxAdditions.run'))

        sudo(clom.umount(mount_point))
        log.warn('It is OK if "Installing the Window System" failed.')

        manage.eject_dvd(self._vbox.name)
Exemple #2
0
def download(url):
    filepath = filecache.get(url)
    filename = path.basename(filepath)
    remotepath = path.join(env.REMOTE_CACHE_DIR, filename)

    if not exists(remotepath):
        if not exists(path.dirname(remotepath)):
            # Using Arg here because LiteralArg escapes ~ and prevents user expansion
            run(clom.mkdir(Arg(path.dirname(remotepath)), p=True))

        put(filepath, remotepath)

    return remotepath
Exemple #3
0
def download(url):
    filepath = filecache.get(url)
    filename = path.basename(filepath)
    remotepath = path.join(env.REMOTE_CACHE_DIR, filename)

    if not exists(remotepath):
        if not exists(path.dirname(remotepath)):
            # Using Arg here because LiteralArg escapes ~ and prevents user expansion
            run(clom.mkdir(Arg(path.dirname(remotepath)), p=True))

        put(filepath, remotepath)

    return remotepath
Exemple #4
0
    def install_guest_additions(self, **kwargs):
        """
        Installs guest additions into the VM.
        """
        puts('Installing guest additions...')

        dvd = manage.load_dvd(self.id, manage.guest_additions_iso, **kwargs)

        mount_point = '/media/cdrom'

        sudo(clom.mkdir(mount_point, p=True))

        with settings(warn_only=True):
            # See if the directory is mounted
            r = sudo(clom.mountpoint(mount_point))
        if r.return_code == 0:
            # Directory is mounted, unmount
            sudo(clom.umount(mount_point))

        with settings(warn_only=True):
            tries = 0
            while tries < 3:
                r = sudo(clom.mount('/dev/cdrom', mount_point))
                if r.return_code == 0:
                    # Mounted
                    break
                else:
                    # cdrom busy, try again
                    tries +=1
                    time.sleep(5)

        with cd(mount_point):
            with settings(warn_only=True):
                # We ignore errors because X11 install may fail if X11 isn't availible
                # TODO Ignore certain failures but not all
                sudo(clom.sh()['VBoxLinuxAdditions.run']('force'))
                puts('It is OK if "Installing the Window System" failed.')

        sudo(clom.umount(mount_point))

        dvd.eject()

        # Fix it so the correct version is reported when VM starts
        # see https://groups.google.com/forum/?fromgroups=#!topic/vagrant-up/L2wEF5dHP9g
        product = manage.guestproperty(self.id, '/VirtualBox/GuestInfo/OS/Product')
        manage.guestproperty(self.id, '/VirtualBox/GuestInfo/OS/Product', product)
Exemple #5
0
def download(url):
    """
    Download a file from `url` into filecache if needed and
    copy to provisioning box.
    """
    filepath = filecache.get(url)
    filename = path.basename(filepath)
    remotepath = path.join(env.REMOTE_CACHE_DIR, filename)

    if not exists(remotepath):
        if not exists(path.dirname(remotepath)):
            # Using Arg here because LiteralArg escapes ~ and prevents user expansion
            run(clom.mkdir(Arg(path.dirname(remotepath)), p=True))

        put(filepath, remotepath)

    return remotepath