示例#1
0
文件: fridge.py 项目: emulbreh/ecs
def fridge_refill(appname, flavor="default", refill_behavior= RB_IGNORE):
    '''
    refill fridge: appname, flavor, refill_behavior
    
    refill_behavior= 
    "abort-if-existing" abort if file to be downloaded already exists
    "ignore-if-existing" ignore file to be downloaded if already exists 
    "update-if-different" update file if file to be downloaded is unequal stored file 
    "overwrite-existing" download file and overwrite regardless if already there and equal 
    '''
    if refill_behavior not in REFILL_BEHAVIOR:
        abort("refill behavior can be only one of %s" % str(REFILL_BEHAVIOR))
    
    if not os.path.exists(_fridgedir()):
        os.makedirs(_fridgedir())

    appconfigfile = os.path.join(fabdir(), appname, 'application.py')
    appconfig = import_from(appconfigfile)
    try:
        package_bundles = appconfig.package_bundles
    except AttributeError:
        abort('package_bundles is not defined')  
    try:
        package_bundle = package_bundles[flavor]
    except KeyError:
        abort('No flavor "%s"\n' % flavor)
    
    package_bundle= package_merge(package_bundle)
   
    for line in package_bundle.splitlines():       
        (name, pkgtype, platform, resource, url, opt1, opt2) = packageline_split(line)
        if name is None:
            continue
        if resource not in ['https', 'http', 'ftp', 'pypi']:
            continue
        if resource == "pypi":
            url = url.replace('\\','')
        elif resource in ["http", "https", "ftp"]:
            url = "".join((resource,":",url))

        print "freezing ", name, pkgtype, platform, resource, url, opt1, opt2, " as ", _frozenname(resource, url)
        _transfer_to_fridge(resource, url, refill_behavior)
示例#2
0
 ./bootstrap.py --baseline /home/ecsdev/baseline
# needs apache config snippet (see apache.conf)
# needs apache wsgi snippet (see main.wsgi)
# these should not be generated inside the sourcedir, because main.wsgi is restarted if file is touched
# needs ecs-main application celeryd upstart.conf
# needs mediaserver application celeryd upstart.conf
"""


# Environments
###############

testing_bundle = main_packages
default_bundle = main_packages
future_bundle = main_packages
developer_bundle = package_merge((default_bundle, quality_packages, developer_packages))
quality_bundle = package_merge((default_bundle, quality_packages))
system_bundle = package_merge((default_bundle, system_packages))

package_bundles = {
    'default': default_bundle,
    'testing': testing_bundle,
    'future': future_bundle,
    'developer': developer_bundle,
    'quality': quality_bundle,
    'qualityaddon': quality_packages,
    'system': system_bundle,
}

logrotate_targets = {
    'default': '*.log'