Ejemplo n.º 1
0
 def get_all(cls, context):
     resources_db = db_api.resource_get_all(context)
     resources = [
         (resource_name, cls._from_db_object(cls(context), context, resource_db))
         for resource_name, resource_db in six.iteritems(resources_db)
     ]
     return dict(resources)
Ejemplo n.º 2
0
 def resources_by_logical_name(self, logical_name):
     ret = []
     resources = db_api.resource_get_all(self.cntxt)
     for res in resources:
         if (res.name == logical_name and res.action in ("CREATE", "UPDATE")
            and res.status == "COMPLETE"):
             ret.append(res)
     return ret
Ejemplo n.º 3
0
 def get_all(cls, context):
     resources_db = db_api.resource_get_all(context)
     resources = [
         (resource_name,
          cls._from_db_object(cls(context), context, resource_db))
         for resource_name, resource_db in six.iteritems(resources_db)
     ]
     return dict(resources)
Ejemplo n.º 4
0
 def resources_by_logical_name(self, logical_name):
     ret = []
     resources = db_api.resource_get_all(self.cntxt)
     for res in resources:
         if (res.name == logical_name and res.action in ("CREATE", "UPDATE")
                 and res.status == "COMPLETE"):
             ret.append(res)
     return ret
Ejemplo n.º 5
0
    def all_resources(self):
        try:
            resources = db_api.resource_get_all(self.cntxt)
        except exception.NotFound:
            return []

        ret = []
        for res in resources:
            if res.action in ("CREATE", "UPDATE") and res.status == "COMPLETE":
                ret.append(res)
        return ret
Ejemplo n.º 6
0
    def all_resources(self):
        try:
            resources = db_api.resource_get_all(self.cntxt)
        except exception.NotFound:
            return []

        ret = []
        for res in resources:
            if res.action in ("CREATE", "UPDATE") and res.status == "COMPLETE":
                ret.append(res)
        return ret
Ejemplo n.º 7
0
    def test_resource_get_all(self):
        values = [
            {'name': 'res1'},
            {'name': 'res2'},
            {'name': 'res3'},
        ]
        [create_resource(self.ctx, self.stack, **val) for val in values]

        resources = db_api.resource_get_all(self.ctx)
        self.assertEqual(3, len(resources))

        names = [resource.name for resource in resources]
        [self.assertIn(val['name'], names) for val in values]
Ejemplo n.º 8
0
    def test_resource_get_all(self):
        values = [
            {'name': 'res1'},
            {'name': 'res2'},
            {'name': 'res3'},
        ]
        [create_resource(self.ctx, self.stack, **val) for val in values]

        resources = db_api.resource_get_all(self.ctx)
        self.assertEqual(3, len(resources))

        names = [resource.name for resource in resources]
        [self.assertIn(val['name'], names) for val in values]
Ejemplo n.º 9
0
# Connecting to heat db using interpreter and run commands

from heat.common import import context
from oslo_config import cfg

cfg.CONF.set_override('connection','mysql+pymysql://root:[email protected]/heat?charset=utf8',
                      group='database')

# this api is api.py in devstack-help. Add this to PYTHONPATH
# IMPORTANT: Make sure you have correct admin url in api.py
from api import keystone as me

ctx=context.RequestContext(auth_token=me.auth_token, user=me.username,
        tenant_id=me.tenant_id,
        request_id=me.request,user_domain_id=me.user_domain_id,project_domain_id=me.project_domain_id,
        is_admin=False)

from heat.db.sqlalchemy import import api as db_api

db_api.resource_get_all(ctx)