def main(argv): flags.init() logsetting.init() clusterids = [ int(clusterid) for clusterid in flags.OPTIONS.clusterids.split(',') if clusterid ] with database.session() as session: if not clusterids: clusters = session.query(Cluster).all() trigger_clusterids = [cluster.id for cluster in clusters] else: trigger_clusterids = clusterids logging.info('trigger installer for clusters: %s', trigger_clusterids) for clusterid in trigger_clusterids: hosts = session.query( ClusterHost).filter_by( cluster_id=clsuterid).all() hostids = [host.id for host in hosts] if flags.OPTIONS.async: celery.send_task('compass.tasks.trigger_install', (clusterid, hostids)) else: trigger_install.trigger_install(clusterid, hostids)
def triggerinstall(clusterid): """Deploy the given cluster. :param clusterid: the id of the cluster to deploy. :type clusterid: int """ with database.session(): trigger_install.trigger_install(clusterid)
def triggerInstall(clusterid): """Trigger install progress for the given cluster. Args: clusterid: int. Used to query a host table to get host configurations. Returns: None """ with database.session(): trigger_install.trigger_install(clusterid)
def _test(self, config_filename): full_path = '%s/data/%s' % ( os.path.dirname(os.path.abspath(__file__)), config_filename) config_globals = {} config_locals = {} execfile(full_path, config_globals, config_locals) self._prepare_database(config_locals) self._mock_os_installer(config_locals) self._mock_package_installer(config_locals) with database.session() as session: clusters = session.query(Cluster).all() for cluster in clusters: clusterid = cluster.id hostids = [host.id for host in cluster.hosts] trigger_install.trigger_install(clusterid, hostids) self._check_os_installer(config_locals) self._check_package_installer(config_locals)
def main(argv): flags.init() logsetting.init() clusterids = [ int(clusterid) for clusterid in flags.OPTIONS.clusterids.split(',') if clusterid ] with database.session() as session: if not clusterids: clusters = session.query(Cluster).all() trigger_clusterids = [cluster.id for cluster in clusters] else: trigger_clusterids = clusterids logging.info('trigger installer for clusters: %s', trigger_clusterids) for clusterid in trigger_clusterids: if flags.OPTIONS. async: celery.send_task('compass.tasks.trigger_install', (clusterid, )) else: trigger_install.trigger_install(clusterid)