Beispiel #1
0
def install_files(self, app, settings, config):
    '''install files will add files (or directories) to a destination.
       If none specified, they are placed in the app base

       Parameters
       ==========
       app should be the name of the app, for lookup in config['apps']
       settings: the output of _init_app(), a dictionary of environment vars
       config: should be the config for the app obtained with self.app(app)

    '''
    if "appfiles" in config:
        files = config['appfiles']
        bot.info('+ ' + 'appfiles '.ljust(5) + app)

        for pair in files:
        
            # Step 1: determine source and destination
            src, dest = get_parts(pair, default=settings['approot'])

            # Step 2: copy source to destination
            cmd = ['cp']

            if os.path.isdir(src):
                cmd.append('-R')
            elif os.path.exists(src):
                cmd = cmd + [src, dest]
                result = self._run_command(cmd)
            else:    
                bot.warning('%s does not exist, skipping.' %src)
Beispiel #2
0
def install_labels(self, app, settings, config):
    '''install labels will add labels to the app labelfile

       Parameters
       ==========
       app should be the name of the app, for lookup in config['apps']
       settings: the output of _init_app(), a dictionary of environment vars
       config: should be the config for the app obtained with self.app(app)

    '''
    lookup = dict()
    if "applabels" in config:
        labels = config['applabels']
        bot.level
        bot.info('+ ' + 'applabels '.ljust(5) + app)
        for line in labels:
            label, value = get_parts(line, default='')
            lookup[label] = value 
        write_json(lookup, settings['applabels'])
    return lookup
Beispiel #3
0
def preview_labels(self, app, settings, config):
    """preview labels for an app

       Parameters
       ==========
       app should be the name of the app, for lookup in config['apps']
       settings: the output of _init_app(), a dictionary of environment vars
       config: should be the config for the app obtained with self.app(app)

    """
    lookup = ""
    if "applabels" in config:
        labels = config["applabels"]
        bot.info("+ " + "applabels ".ljust(5) + app)
        print(settings["applabels"])
        for line in labels:
            label, value = get_parts(line, default="")
            lookup += "%s=%s\n" % (label, value)
        print(lookup)
    return lookup
Beispiel #4
0
def preview_labels(self, app, settings, config):
    '''preview labels for an app

       Parameters
       ==========
       app should be the name of the app, for lookup in config['apps']
       settings: the output of _init_app(), a dictionary of environment vars
       config: should be the config for the app obtained with self.app(app)

    '''
    lookup = ''
    if "applabels" in config:
        labels = config['appfiles']
        bot.info('+ ' + 'applabels '.ljust(5) + app)
        print(settings['applabels'])
        for line in labels:
            label, value = get_parts(line, default='')
            lookup += '%s=%s\n' %(label,value)
        print(lookup)
    return lookup
Beispiel #5
0
def preview_files(self, app, settings, config):
    """install files will add files (or directories) to a destination.
       If none specified, they are placed in the app base

       Parameters
       ==========
       app should be the name of the app, for lookup in config['apps']
       settings: the output of _init_app(), a dictionary of environment vars
       config: should be the config for the app obtained with self.app(app)

    """

    if "appfiles" in config:
        files = config["appfiles"]
        bot.info("+ " + "appfiles ".ljust(5) + app)

        for pair in files:

            # Step 1: determine source and destination
            src, dest = get_parts(pair, default=settings["approot"])
            print("%s --> %s \n" % (src, dest))