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))
def task_halt(self, task, config, guests): self.call(VagrantCommandActor('halt'), config=config, sequence=False, guests=guests)
def halt(self, task, args): self.call(VagrantCommandActor('halt'), args)
def up(self, task, args): self.call(VagrantCommandActor('up'), args)
def update(self, task, args): self.call(VagrantCommandActor('box update'), args)
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), ]))
def destroy(self, task, args): self.call(VagrantCommandActor('destroy'), args)