def list_templates(ctx): """Display templates that can be used by native Kubernetes provider.""" try: restore_session(ctx) client = ctx.obj['client'] cluster = Cluster(client) result = cluster.get_templates() stdout(result, ctx, sort_headers=False) except Exception as e: stderr(e, ctx)
def list_templates(ctx): """Display templates that can be used by native Kubernetes provider.""" CLIENT_LOGGER.debug(f'Executing command: {ctx.command_path}') try: restore_session(ctx) client = ctx.obj['client'] cluster = Cluster(client) result = cluster.get_templates() stdout(result, ctx, sort_headers=False) CLIENT_LOGGER.debug(result) except Exception as e: stderr(e, ctx) CLIENT_LOGGER.error(str(e))
def list_templates(ctx): try: client = ctx.obj['client'] cluster = Cluster(client) result = [] templates = cluster.get_templates() for t in templates: result.append({'name': t['name'], 'description': t['description'], 'catalog': t['catalog'], 'catalog_item': t['catalog_item'], 'is_default': t['is_default'], }) stdout(result, ctx, show_id=True) except Exception as e: stderr(e, ctx)
def list_templates(ctx): """Display templates that can be used by native Kubernetes provider.""" try: restore_session(ctx) client = ctx.obj['client'] cluster = Cluster(client) result = [] templates = cluster.get_templates() for t in templates: result.append({ 'name': t['name'], 'description': t['description'], 'catalog': t['catalog'], 'catalog_item': t['catalog_item'], 'is_default': t['is_default'], }) stdout(result, ctx, show_id=True) except Exception as e: stderr(e, ctx)
def test_01_template_list(self): logged_in_org = self.client.get_org() assert self.config['vcd']['org'] == logged_in_org.get('name') cluster = Cluster(self.client) templates = cluster.get_templates() assert len(templates) > 0