Example #1
0
    def retrieve_container_status_from_containerName(self, container_name):
        cluster = get_containerClusterName_from_containerName(container_name)
        container_node = self.get_container_node_from_container_name(
            cluster, container_name)

        zkOper = Container_ZkOpers()
        status_value = zkOper.retrieve_container_status_value(
            cluster, container_node)
        return status_value
    def container_cluster_status_validator(self, cluster):
        zkOper = Container_ZkOpers()

        container_node_list = zkOper.retrieve_container_list(cluster)
        status_list, result = [], {}
        for container_node in container_node_list:
            status_node_value = zkOper.retrieve_container_status_value(
                cluster, container_node)
            status_list.append(status_node_value.get('status'))

        status = self.__get_cluster_status(status_list)
        result.setdefault('status', status)

        if status == Status.destroyed:
            logging.info('delete containerCluster: %s record in zookeeper' %
                         cluster)
            zkOper.delete_container_cluster(cluster)

        return result