示例#1
0
文件: docker.py 项目: cecedille1/Sett
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
from paver.easy import task, consume_nargs, debug, info, environment, error

from sett.utils import optional_import, task_name as rename_task
from sett.task_loaders import RegexpTaskLoader
docker = optional_import('docker', 'docker-py')


class Container(object):
    def __init__(self, name, client=None):
        self.name = name
        self.client = client or docker.Client()

    def __str__(self):
        return self.name

    @property
    def ip(self):
        return self.properties['NetworkSettings']['IPAddress']

    def exists(self):
        return self.properties is not None

    def is_started(self):
        if self.properties is None:
            return False
        return self.properties['State']['Running']
示例#2
0
文件: tar.py 项目: cecedille1/Sett
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import optparse
import tempfile
import io

from tarfile import TarFile

from paver.easy import task, path, consume_nargs, info, cmdopts

from sett import defaults
from sett.utils import optional_import

requests = optional_import('requests')


class TarExtract(object):
    def __init__(self, web_archive):
        self.web_archive = web_archive
        self.tf = None

    def __enter__(self):
        if self.tf is not None:
            raise ValueError('Cannot re-enter')

        if '://' in self.web_archive:
            info('Downloading from {0}'.format(self.web_archive))
            dl = requests.get(self.web_archive)
示例#3
0
文件: deploy.py 项目: cecedille1/Sett
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from paver.easy import path, task, call_task, needs, info, debug, consume_args, error, sh

from sett import ROOT, defaults, which
from sett.utils import optional_import
from sett.utils.dispatch import Dispatcher
from sett.deploy_context import DeployContext

jinja2 = optional_import('jinja2')
_jinja_instance = None


@task
@needs(['wheel'])
def push(options):
    """Pushes the archive in the enix repo"""
    call_task('sdist')
    call_task('upload', options={
        'repository': defaults.PYPI_REPOSITORY,
    })


@task
def etc():
    """
    Make the etc directory with the conf files
    """
    call_task('nginx_conf')
    call_task('monit_conf')