Exemplo n.º 1
0
    def task_update(self, task, suite, config):
        machines = set()
        for case in suite:
            machines.update(case.get('machines', []))

        self.call(VagrantCommandActor('box update'),
                  config=config,
                  sequence=False,
                  guests=list(machines))
Exemplo n.º 2
0
 def task_halt(self, task, config, guests):
     self.call(VagrantCommandActor('halt'),
               config=config,
               sequence=False,
               guests=guests)
Exemplo n.º 3
0
 def halt(self, task, args):
     self.call(VagrantCommandActor('halt'), args)
Exemplo n.º 4
0
 def up(self, task, args):
     self.call(VagrantCommandActor('up'), args)
Exemplo n.º 5
0
 def update(self, task, args):
     self.call(VagrantCommandActor('box update'), args)
Exemplo n.º 6
0
        result = self.vagrant(args.config,
                              'box prune',
                              args=vgargs,
                              stdout=subprocess.PIPE)
        for (box, version) in regex.findall(result.stdout.decode('utf-8')):
            volume = '{box}_vagrant_box_image_{version}.img'.format(
                box=box.replace('/', '-VAGRANTSLASH-'), version=version)

            self.message('Box {}, version {} is outdated.'.format(
                box, version))
            self.message('  ...removing {}'.format(volume))

            self.shell('''
            sudo virsh vol-info {volume} --pool {pool} &> /dev/null
            if [ $? -ne 0 ]; then
                exit 0
            fi

            sudo virsh vol-delete {volume} --pool {pool}
            '''.format(volume=volume, pool='sssd-test-suite'))


Commands = Command(
    'box', 'Update and create boxes',
    CommandParser([
        Command('update', 'Update vagrant box',
                VagrantCommandActor('box update')),
        Command('prune', 'Delete all outdated vagrant boxes', PruneBoxActor),
        Command('create', 'Create new vagrant box', CreateBoxActor),
    ]))
Exemplo n.º 7
0
 def destroy(self, task, args):
     self.call(VagrantCommandActor('destroy'), args)