dockupdater/lib/config.py
def from_labels(cls, config, labels):
        """Create a new config object from an existing config and a dict of docker labels"""
        options = deepcopy(config.options)

        if labels:
            for label, value in labels.items():
                if label in LABELS_MAPPING:
                    if label in ["dockupdater.notifiers"]:
                        options[LABELS_MAPPING[label]] = value.split(" ")
                    elif label in ["dockupdater.latest", "dockupdater.cleanup"]:
                        options[LABELS_MAPPING[label]] = convert_to_boolean(value)
                    elif label in ["dockupdater.wait"]:
                        options[LABELS_MAPPING[label]] = int(value)
                    elif label in ["dockupdater.stops", "dockupdater.starts"]:
                        options[LABELS_MAPPING[label]] = [OptionRegex(item) for item in value.split(" ")]
                    else:
                        options[LABELS_MAPPING[label]] = value
                    if label == "dockupdater.template_file":
                        # Reload template
                        options["template"] = Config.load_template(options.get('template_file'))
                elif label.startswith("dockupdater."):
                    config.logger.warning("Warning label %s doesn't exist", label)

        return cls(**options)
Create a new config object from an existing config and a dict of docker labels
Create a new config object from an existing config and a dict of docker labels
Create a new config object from an existing config and a dict of docker labels
def from_labels(cls, config, labels):
        options = deepcopy(config.options)
        if labels:
            for label, value in labels.items():
                if label in LABELS_MAPPING:
                    if label in ["dockupdater.notifiers"]:
                        options[LABELS_MAPPING[label]] = value.split(" ")
                    elif label in ["dockupdater.latest", "dockupdater.cleanup"]:
                        options[LABELS_MAPPING[label]] = convert_to_boolean(value)
                    elif label in ["dockupdater.wait"]:
                        options[LABELS_MAPPING[label]] = int(value)
                    elif label in ["dockupdater.stops", "dockupdater.starts"]:
                        options[LABELS_MAPPING[label]] = [OptionRegex(item) for item in value.split(" ")]
                    else:
                        options[LABELS_MAPPING[label]] = value
                    if label == "dockupdater.template_file":
                        options["template"] = Config.load_template(options.get('template_file'))
                elif label.startswith("dockupdater."):
                    config.logger.warning("Warning label %s doesn't exist", label)
        return cls(**options)
def from_labels ( cls , config , labels ) : options = deepcopy ( config . options ) if labels : for label , value in labels . items ( ) : if label in LABELS_MAPPING : if label in [ "dockupdater.notifiers" ] : options [ LABELS_MAPPING [ label ] ] = value . split ( " " ) elif label in [ "dockupdater.latest" , "dockupdater.cleanup" ] : options [ LABELS_MAPPING [ label ] ] = convert_to_boolean ( value ) elif label in [ "dockupdater.wait" ] : options [ LABELS_MAPPING [ label ] ] = int ( value ) elif label in [ "dockupdater.stops" , "dockupdater.starts" ] : options [ LABELS_MAPPING [ label ] ] = [ OptionRegex ( item ) for item in value . split ( " " ) ] else : options [ LABELS_MAPPING [ label ] ] = value if label == "dockupdater.template_file" : options [ "template" ] = Config . load_template ( options . get ( 'template_file' ) ) elif label . startswith ( "dockupdater." ) : config . logger . warning ( "Warning label %s doesn't exist" , label ) return cls ( ** options )
Create a new config object from an existing config and a dict of docker labels
Create a new config object from an existing config and a dict of docker labels
"""Create a new config object from an existing config and a dict of docker labels""" # Reload template
cls
config
labels