示例#1
0
    def task_uploadRelease(self, release, releasesTarball):
        """
        Upload a relase.

        It expects a tarball containing the following files:
        - Twisted<Subproject>-<release>.tar.bz2
        - Twisted-<release>.<ext> for all source/windows installers
        - twisted-<release>-<hash>.txt for md5 and sha512
        - doc - for narative documentation
        - api - for api documents

        @param release: Release version.
        @param releasesTarball: Tarball with release tarballs and documentation
        """
        apiVersion = '.'.join(release.split('.')[:2])
        distPaths = {}
        for ext in ['.tar.bz2', '-cp27-cp27m-win_amd64.whl']:
            tarball = 'Twisted-{}{}'.format(release, ext)
            distPaths[tarball] = 'data/releases/Twisted/{}/{}'.format(apiVersion, tarball)

        distPaths['doc'] = 'data/documentation/{}'.format(release)
        distPaths['api'] = 'data/documentation/{}/api'.format(release)
        for hash in ['md5sums', 'shasums']:
            hashFile = 'twisted-{}-{}.txt'.format(release,hash)
            distPaths[hashFile] = 'data/releases/{}'.format(hashFile)

        directories = [path.dirname(file) for file in distPaths.values()]

        with settings(user=self.serviceUser):
            run('/bin/mkdir -p {}'.format(' '.join(set(directories))))
            archive.restore(distPaths, releasesTarball)
示例#2
0
    def task_restore(self, localfile, restoreDb=True):
        """
        Restore all information not stored in version control from a tarball
        on the invoking users machine.
        """
        restoreDb = str(restoreDb).lower() in ('true', '1', 'yes', 'ok', 'y')

        if restoreDb:
            msg = (
                'All existing files present in the backup will be overwritten and\n'
                'the database dropped and recreated.'
            )
        else:
            msg = (
                'All existing files present in the backup will be overwritten\n'
                '(the database will not be touched).'
            )

        print ''
        if confirm(msg):
            # TODO: Ask for confirmation here
            if restoreDb:
                postgres.dropDb('trac')
                postgres.createDb('trac', 'trac')

            with settings(user=self.serviceUser):
                with utils.tempfile() as temp:
                    archive.restore({
                        'htpasswd': 'config/htpasswd',
                        'attachments': 'attachments',
                        'db.dump': temp,
                    }, localfile)
                    if restoreDb:
                        postgres.restoreFromPath('trac', temp)
示例#3
0
    def task_uploadRelease(self, release, releasesTarball):
        """
        Upload a relase.

        It expects a tarball containing the following files:
        - Twisted<Subproject>-<release>.tar.bz2
        - Twisted-<release>.<ext> for all source/windows installers
        - twisted-<release>-<hash>.txt for md5 and sha512
        - doc - for narative documentation
        - api - for api documents

        @param release: Release version.
        @param releasesTarball: Tarball with release tarballs and documentation
        """
        apiVersion = '.'.join(release.split('.')[:2])
        distPaths = {}
        for ext in ['.tar.bz2', '-cp27-none-win_amd64.whl']:
            tarball = 'Twisted-{}{}'.format(release, ext)
            distPaths[tarball] = 'data/releases/Twisted/{}/{}'.format(apiVersion, tarball)

        distPaths['doc'] = 'data/documentation/{}'.format(release)
        distPaths['api'] = 'data/documentation/{}/api'.format(release)
        for hash in ['md5sums', 'shasums']:
            hashFile = 'twisted-{}-{}.txt'.format(release,hash)
            distPaths[hashFile] = 'data/releases/{}'.format(hashFile)

        directories = [path.dirname(file) for file in distPaths.values()]

        with settings(user=self.serviceUser):
            run('/bin/mkdir -p {}'.format(' '.join(set(directories))))
            archive.restore(distPaths, releasesTarball)
示例#4
0
    def task_restore(self, localfile, restoreDb=True, withAttachments=True):
        """
        Restore all information not stored in version control from a tarball
        on the invoking users machine.
        """
        restoreDb = str(restoreDb).lower() in ('true', '1', 'yes', 'ok', 'y')

        if restoreDb:
            msg = (
                'All existing files present in the backup will be overwritten and\n'
                'the database dropped and recreated.')
        else:
            msg = (
                'All existing files present in the backup will be overwritten\n'
                '(the database will not be touched).')

        print('')
        if confirm(msg):
            # TODO: Ask for confirmation here
            if restoreDb:
                postgres.dropDb('trac')
                postgres.createDb('trac', 'trac')

            with settings(user=self.serviceUser):
                with utils.tempfile() as temp:
                    files = {
                        'db.dump': temp,
                    }

                    if withAttachments is True:
                        files['attachments'] = 'attachments'

                    archive.restore(files, localfile)
                    if restoreDb:
                        postgres.restoreFromPath('trac', temp)
示例#5
0
文件: fabfile.py 项目: wallrj/t-web
 def task_restore(self, dump):
     """
     Resotre non-versioned resources.
     """
     msg = 'All non-versioned web resources will be replaced with the backup.'
     if confirm(msg):
         with settings(user=self.serviceUser):
             archive.restore({
                 'data': 'data',
                 }, dump)
示例#6
0
 def task_restore(self, dump):
     """
     Restore mailman data.
     """
     msg = 'All mailman state and archives will be replaced with the backup.'
     if confirm(msg):
         with settings(user=self.serviceUser):
             archive.restore({
                 'lists': 'lists',
                 'data': 'data',
                 'archives': 'archives'
             }, dump)
    def task_restore(self, localfile):
        """
        Restore all information not stored in version control from a tarball
        on the invoking users machine.
        """
        msg = 'The whole data directory will be replaced with the backup.'

        if confirm(msg):
            with settings(user=self.serviceUser):
                archive.restore({
                    'data': 'data',
                }, localfile)
    def task_restore(self, localfile):
        """
        Restore all information not stored in version control from a tarball
        on the invoking users machine.
        """
        msg = 'The whole data directory will be replaced with the backup.'

        if confirm(msg):
            with settings(user=self.serviceUser):
                archive.restore({
                    'data': 'data',
                }, localfile)
示例#9
0
 def task_restore(self, dump):
     """
     Restore mailman data.
     """
     msg = 'All mailman state and archives will be replaced with the backup.'
     if confirm(msg):
         with settings(user=self.serviceUser):
             archive.restore(
                 {
                     'lists': 'lists',
                     'data': 'data',
                     'archives': 'archives'
                 }, dump)
示例#10
0
    def task_restore(self, localfile):
        """
        Restore codespeed database from the given C{localfile}.
        """
        msg = 'The whole database will be replaced with the backup.'

        if utils.confirm(msg):
            with settings(user=self.serviceUser):
                with utils.tempfile() as temp:
                    archive.restore({
                        'db.dump': temp,
                    }, localfile)
                    run('/bin/rm -f ~/data/codespeed.db')
                    run('/usr/bin/sqlite3 ~/data/codespeed.db ".read {}"'.format(temp))