Example #1
0
    def _build_nodes_from_bambino_dicts(self, nodes_as_dicts):
        """
        Return node objects from the nodes as dicts dictionary using the
        Bambino data.

        The nodes will still be missing the config dict and supervisor_service_names
        list.

        Example nodes_as_dicts
            {
                "mtclone-pyweb01": {
                    "url": "http://192.168.4.13:6666",
                    "ip": "192.168.4.13",
                    "name": "mtclone-pyweb01",
                    "site": "mtclone"
                }
            }

        Example nodes:
            nodes = {
                "node_name": Node Object
            }
        """
        nodes = {}

        for node_name, node_as_dict in nodes_as_dicts.iteritems():
            nodes[node_name] = Node(node_name,
                                    dirify(node_as_dict['site']),
                                    node_as_dict['url'],
                                    node_as_dict['ip'])

        return nodes
Example #2
0
 def __init__(self, name, status='unknown', nodes={}, services={}):
     self.name = name
     self.name_url = dirify(name)
     self.status = status
     self.nodes = nodes
     self.services = services
     self.redis = Redis.get_instance()
Example #3
0
 def __init__(self, name, site_name, url, applications={}):
     self.name = name
     self.name_url = dirify(name)
     self.site_name = site_name
     self.url = url
     self.applications = applications
     self.errors = [ ]
Example #4
0
 def __init__(self, name, site_name, node_name, url,
     current_branch_app='', current_branch_config='',
     change_count_app='', change_count_config='',
     is_dirty_app=False, is_dirty_config=False,
     last_tag_app='', last_tag_config='', last_tag_message='',
     status='', remote='', repo='', packages=[], changed_files=[], notes={}):
     self.name = name
     self.site_name = site_name
     self.node_name = node_name
     self.name_url = dirify(name)
     self.url = url
     
     self.current_branch_app = current_branch_app
     self.current_branch_config = current_branch_config
     
     self.change_count_app = change_count_app
     self.change_count_config = change_count_config
     
     self.is_dirty_app = is_dirty_app
     self.is_dirty_config = is_dirty_config
     
     self.last_tag_app = last_tag_app
     self.last_tag_config = last_tag_config
     self.last_tag_message = last_tag_message
     
     self.status = status
     self.remote = remote
     self.packages = packages
     self.changed_files = changed_files
     self.notes = notes
Example #5
0
    def register_node(self, node):
        """
        Register a bambino with Doula. The node is a simple dict.

        Example Node:
            {
                "url": "http://5.5.0.66:6542",
                "ip": "5.5.0.66",
                "name": "mt1",
                "site": "mt1"
            }

        Example Site:
            {
                "name": "mtclone",
                "nodes": {
                    "mtclone-pyweb01": {
                        "url": "http://192.168.4.13:6666",
                        "ip": "192.168.4.13",
                        "name": "mtclone-pyweb01",
                        "site": "mtclone"
                    }
                }
            }
        """
        # The names should always be dirified, makes them comparable
        # that way we can ignore casing and other odd characters
        node["name"] = dirify(node["name"])
        node["site"] = Config.get_safe_site(dirify(node["site"]))
        registered_site = self.get_registered_site(node['site'])

        # log.debug('Registering Site')
        # log.debug(json.dumps(registered_site))

        if node['name'] in registered_site['nodes']:
            registered_site['nodes'][node['name']] = node
            self.save_registered_site(registered_site)
        else:
            # If the node doesn't already exist for the site, add it
            # and update every one of the sites
            registered_site['nodes'][node['name']] = node
            self.save_registered_site(registered_site)
            self.update_site_and_service_models()
Example #6
0
 def __init__(self, name, site_name, url, ip,
              config={}, changed_files=[], supervisor_service_names=[]):
     self.name = name
     self.name_url = dirify(name)
     self.site_name = site_name
     self.url = url
     self.ip = ip
     self.errors = []
     self.config = config
     self.changed_files = changed_files
     self.supervisor_service_names = supervisor_service_names
     self._update_node_config()
Example #7
0
 def _get_site_cache_key(self, name):
     return self.site_prefix + dirify(name)
Example #8
0
 def get_registered_site_redis_key(self, name):
     return 'doula.registered.site:' + dirify(name)
Example #9
0
 def __init__(self, name, status='unknown', nodes={}, applications={}):
     self.name = name
     self.name_url = dirify(name)
     self.status = status
     self.nodes = nodes
     self.applications = applications