コード例 #1
0
ファイル: cat_hostname.py プロジェクト: jrha/aquilon
    def render(self, session, logger, hostname, data, generate, **arguments):
        dbhost = hostname_to_host(session, hostname)
        dbresource = get_resource(session, dbhost, **arguments)
        if dbresource:
            plenary_info = Plenary.get_plenary(dbresource, logger=logger)
        else:
            if data:
                plenary_info = PlenaryHostData(dbhost, logger=logger)
            else:
                plenary_info = PlenaryToplevelHost(dbhost, logger=logger)

        if generate:
            return plenary_info._generate_content()
        else:
            return plenary_info.read()
コード例 #2
0
    def render(self, session, logger, cluster, data, generate, **arguments):
        dbcluster = Cluster.get_unique(session, cluster, compel=True)
        dbresource = get_resource(session, dbcluster, **arguments)
        if dbresource:
            plenary_info = Plenary.get_plenary(dbresource, logger=logger)
        else:
            if isinstance(dbcluster, MetaCluster):
                if data:
                    plenary_info = PlenaryMetaClusterData(dbcluster, logger=logger)
                else:
                    plenary_info = PlenaryMetaClusterObject(dbcluster, logger=logger)
            else:
                if data:
                    plenary_info = PlenaryClusterData(dbcluster, logger=logger)
                else:
                    plenary_info = PlenaryClusterObject(dbcluster, logger=logger)

        if generate:
            return plenary_info._generate_content()
        else:
            return plenary_info.read()