Ejemplo n.º 1
0
class FabricProvisioner(Provisioner):
    provider_name = 'fabric'
    settings_class = FabricProvisionerSettings

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.isolator = Isolator(
            'virtualenv',
            self.performer,
            settings_data=dict(python='2'),
            ident='codev_fabric')

    def install(self):
        # TODO requirements - python-dev, python-virtualenv
        self.isolator.create()
        self.isolator.execute('pip install setuptools')

        version_add = ''
        if self.settings.version:
            version_add = '==%s' % self.settings.version
        self.isolator.execute('pip install --upgrade fabric%s fabtools' % version_add)

    def run(self, infrastructure, info, vars):
        role = self.settings.role or info['environment']

        self.isolator.execute('fab {task} -R {role}'.format(
            task=self.settings.task,
            role=role
        ))

        return True
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.isolator = Isolator(
         'virtualenv',
         self.performer,
         settings_data=dict(python='2'),
         ident='codev_fabric')