示例#1
0
 def update_central_cacerts(self, cert_files, update_certs=True):
     """Update Central certs info if once of cert_files changes"""
     checksums = {path: ch_host.path_hash(path) for path in cert_files}
     yield
     new_checksums = {path: ch_host.path_hash(path) for path in cert_files}
     if checksums != new_checksums and update_certs:
         self.run_update_certs()
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restart_pg()
             break
示例#3
0
 def update_central_cacerts(self, cert_files, update_certs=True):
     """Update Central certs info if once of cert_files changes"""
     checksums = {path: ch_host.path_hash(path)
                  for path in cert_files}
     yield
     new_checksums = {path: ch_host.path_hash(path)
                      for path in cert_files}
     if checksums != new_checksums and update_certs:
         self.run_update_certs()
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             if path == PG_IFCS_CONF:
                 ensure_files()
             restart_pg()
             break
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             if path == PG_IFCS_CONF:
                 ensure_files()
             restart_pg()
             break
示例#6
0
 def restart_on_change(self):
     checksums = {path: path_hash(path) for path in self.restart_map}
     yield
     restarts = []
     for path in self.restart_map:
         if path_hash(path) != checksums[path]:
             restarts += self.restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     for service_name in services_list:
         service_restart(service_name)
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             if path == OPS_CONF:
                 from pg_edge_context import _pg_dir_context
                 opsvm_ip = _pg_dir_context()['opsvm_ip']
                 configure_analyst_opsvm(opsvm_ip)
             restart_pg()
             break
 def render_config(self, restart_trigger):
     """Render the domain specific LDAP configuration for the application
     """
     checksum = ch_host.path_hash(self.configuration_file)
     core.templating.render(source=KEYSTONE_CONF_TEMPLATE,
                            template_loader=os_templating.get_loader(
                                'templates/', self.release),
                            target=self.configuration_file,
                            context=self.adapters_instance)
     if checksum != ch_host.path_hash(self.configuration_file):
         restart_trigger()
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     restarts = []
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restarts += restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     if not stopstart:
         for service_name in services_list:
             service('restart', service_name)
     else:
         for action in ['stop', 'start']:
             for service_name in services_list:
                 service(action, service_name)
                 if action == 'stop' and sleep:
                     time.sleep(sleep)
 def wrapped_f(*args, **kwargs):
     if is_unit_paused_set():
         return f(*args, **kwargs)
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     restarts = []
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restarts += restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     if not stopstart:
         for service_name in services_list:
             service('restart', service_name)
     else:
         for action in ['stop', 'start']:
             for service_name in services_list:
                 service(action, service_name)
                 if action == 'stop' and sleep:
                     time.sleep(sleep)
 def wrapped_f(*args, **kwargs):
     if is_unit_paused_set():
         return f(*args, **kwargs)
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     restarts = []
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restarts += restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     cluster_wait()
     if not stopstart:
         for svc_name in services_list:
             system_service('restart', svc_name)
             wait_app()
     else:
         for action in ['stop', 'start']:
             for svc_name in services_list:
                 system_service(action, svc_name)
                 wait_app()
 def wrapped_f(*args, **kwargs):
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     restarts = []
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restarts += restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     status_set('maintenance',
                'Random wait for restart to avoid collisions')
     time.sleep(random.random() * 100)
     if not stopstart:
         for svc_name in services_list:
             system_service('restart', svc_name)
             wait_app()
     else:
         for action in ['stop', 'start']:
             for svc_name in services_list:
                 system_service(action, svc_name)
                 wait_app()
示例#13
0
    def restart_on_change(self):
        """Restart the services in the self.restart_map{} attribute if any of
        the files identified by the keys changes for the wrapped call.

        This function is a @decorator that checks if the wrapped function
        changes any of the files identified by the keys in the
        self.restart_map{} and, if they change, restarts the services in the
        corresponding list.
        """
        checksums = {path: ch_host.path_hash(path)
                     for path in self.full_restart_map.keys()}
        yield
        restarts = []
        for path in self.full_restart_map:
            if ch_host.path_hash(path) != checksums[path]:
                restarts += self.full_restart_map[path]
        services_list = list(collections.OrderedDict.fromkeys(restarts).keys())
        for service_name in services_list:
            ch_host.service_stop(service_name)
        for service_name in services_list:
            ch_host.service_start(service_name)
示例#14
0
    def restart_on_change(self):
        """Restart the services in the self.restart_map{} attribute if any of
        the files identified by the keys changes for the wrapped call.

        This function is a @decorator that checks if the wrapped function
        changes any of the files identified by the keys in the
        self.restart_map{} and, if they change, restarts the services in the
        corresponding list.
        """
        checksums = {path: ch_host.path_hash(path)
                     for path in self.full_restart_map.keys()}
        yield
        restarts = []
        for path in self.full_restart_map:
            if ch_host.path_hash(path) != checksums[path]:
                restarts += self.full_restart_map[path]
        services_list = list(collections.OrderedDict.fromkeys(restarts).keys())
        for service_name in services_list:
            ch_host.service_stop(service_name)
        for service_name in services_list:
            ch_host.service_start(service_name)
 def wrapped_f(*args, **kwargs):
     if is_unit_paused_set():
         return f(*args, **kwargs)
     checksums = {path: path_hash(path) for path in restart_map}
     f(*args, **kwargs)
     restarts = []
     for path in restart_map:
         if path_hash(path) != checksums[path]:
             restarts += restart_map[path]
     services_list = list(OrderedDict.fromkeys(restarts))
     status_set('maintenance',
                'Random wait for restart to avoid collisions')
     time.sleep(random.random() * 100)
     if not stopstart:
         for svc_name in services_list:
             system_service('restart', svc_name)
             wait_app()
     else:
         for action in ['stop', 'start']:
             for svc_name in services_list:
                 system_service(action, svc_name)
                 wait_app()