Пример #1
0
#
# Tribus is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os
import json
from contextlib import nested
from tribus.common.logger import get_logger
from fabric.api import run, env, settings, sudo, hide, put, cd

log = get_logger()


def check_docker():
    with settings(command='which docker', warn_only=True):
        exit_status = run('%(command)s' % env)
    return exit_status.return_code


def update_packages():
    with settings(command='aptitude update', warn_only=True):
        exit_status = sudo('%(command)s' % env)
    return exit_status.return_code


def put_charm_install():
Пример #2
0
import re
import gzip
import urllib
import urllib2
import email.Utils
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tribus.config.web")
from debian import deb822
from django.db.models import Q
from tribus.common.logger import get_logger
from tribus.web.cloud.models import Package, Details, Relation, Label, Tag,\
Maintainer
from tribus.config.pkgrecorder import PACKAGE_FIELDS, DETAIL_FIELDS
from tribus.common.utils import find_files, md5Checksum,\
list_items, readconfig

logger = get_logger()

# Version alternativa de registro con manejo de excepciones en caso de errores.
#
# @transaction.commit_manually
# def record_maintainer(maintainer_data):
#     """
#     Queries the database for an existent maintainer.
#     If it does not exists, it creates a new maintainer.
#
#     :param maintainer_data: a string which contains maintainer's name and
#     email.
#
#     :return: a `Maintainer` object.
#
#     :rtype: ``Maintainer``