Exemplo n.º 1
0
 def reset(self):
     self.system = System.get_instance()
     self.config = AttributeDictionary()
     self.resources = {}
     self.resource_list = []
     self.delayed_actions = set()
     self.update_config({'date': datetime.now(), 'kokki.long_version': long_version()})
Exemplo n.º 2
0
 def reset(self):
     self.system = System.get_instance()
     self.config = AttributeDictionary()
     self.resources = {}
     self.resource_list = []
     self.delayed_actions = set()
     self.update_config({
         'date': datetime.now(),
         'kokki.long_version': long_version(),
         'kokki.backup.path': '/tmp/kokki/backup',
         'kokki.backup.prefix': datetime.now().strftime("%Y%m%d%H%M%S"),
     })
Exemplo n.º 3
0
 def reset(self):
     self.system = System.get_instance()
     self.config = AttributeDictionary()
     self.resources = {}
     self.resource_list = []
     self.delayed_actions = set()
     self.update_config({
         'date': datetime.now(),
         'kokki.long_version': long_version(),
         'kokki.backup.path': '/tmp/kokki/backup',
         'kokki.backup.prefix': datetime.now().strftime("%Y%m%d%H%M%S"),
     })
Exemplo n.º 4
0

class Environment(AttributeDictionary):
    system = System()

    def __init__(self):
        self.reset()

    def reset(self):
        self.clear()
        self.included_recipes = set()
        self.cookbooks = {}
        self.resources = {}
        self.resource_list = []

    def set_attributes(self, attributes, overwrite=False):
        for k, v in attributes.items():
            attr = self
            path = k.split('.')
            for p in path[:-1]:
                if p not in attr:
                    attr[p] = AttributeDictionary()
                attr = attr[p]
            if overwrite or path[-1] not in attr:
                attr[path[-1]] = v

env = Environment()

from kokki.version import long_version
env.set_attributes({'date':datetime.now(), 'kokki.long_version':long_version()})