diff options
Diffstat (limited to 'heat')
-rw-r--r-- | heat/db/api.py | 5 | ||||
-rw-r--r-- | heat/db/sqlalchemy/api.py | 22 | ||||
-rw-r--r-- | heat/db/sqlalchemy/models.py | 26 | ||||
-rw-r--r-- | heat/db/sqlalchemy/utils.py | 4 |
4 files changed, 29 insertions, 28 deletions
diff --git a/heat/db/api.py b/heat/db/api.py index 33d4bec8a..ede8cdc9e 100644 --- a/heat/db/api.py +++ b/heat/db/api.py @@ -11,8 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -''' -Interface for database access. +"""Interface for database access. Usage: @@ -22,7 +21,7 @@ Usage: The underlying driver is loaded . SQLAlchemy is currently the only supported backend. -''' +""" from oslo_config import cfg from oslo_db import api diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index 27790dbb0..2b94cbfe5 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -11,7 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -'''Implementation of SQLAlchemy backend.''' +"""Implementation of SQLAlchemy backend.""" import datetime import sys @@ -178,9 +178,9 @@ def resource_update(context, resource_id, values, atomic_key, def resource_data_get_all(resource, data=None): - """ - Looks up resource_data by resource.id. If data is encrypted, - this method will decrypt the results. + """Looks up resource_data by resource.id. + + If data is encrypted, this method will decrypt the results. """ if data is None: data = (model_query(resource.context, models.ResourceData) @@ -200,8 +200,9 @@ def resource_data_get_all(resource, data=None): def resource_data_get(resource, key): - """Lookup value of resource's data by key. Decrypts resource data if - necessary. + """Lookup value of resource's data by key. + + Decrypts resource data if necessary. """ result = resource_data_get_by_key(resource.context, resource.id, @@ -242,8 +243,9 @@ def stack_tags_get(context, stack_id): def resource_data_get_by_key(context, resource_id, key): - """Looks up resource_data by resource_id and key. Does not unencrypt - resource_data. + """Looks up resource_data by resource_id and key. + + Does not decrypt resource_data. """ result = (model_query(context, models.ResourceData) .filter_by(resource_id=resource_id) @@ -361,12 +363,12 @@ def stack_get_all_by_owner_id(context, owner_id): def _get_sort_keys(sort_keys, mapping): - '''Returns an array containing only whitelisted keys + """Returns an array containing only whitelisted keys :param sort_keys: an array of strings :param mapping: a mapping from keys to DB column names :returns: filtered list of sort keys - ''' + """ if isinstance(sort_keys, six.string_types): sort_keys = [sort_keys] return [mapping[key] for key in sort_keys or [] if key in mapping] diff --git a/heat/db/sqlalchemy/models.py b/heat/db/sqlalchemy/models.py index 287bf4b2b..fe03c2f89 100644 --- a/heat/db/sqlalchemy/models.py +++ b/heat/db/sqlalchemy/models.py @@ -10,9 +10,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -""" -SQLAlchemy models for heat data. -""" + +"""SQLAlchemy models for heat data.""" import uuid @@ -119,6 +118,7 @@ class StackTag(BASE, HeatBase): class SyncPoint(BASE, HeatBase): """Represents an syncpoint for an stack that is being worked on.""" + __tablename__ = 'sync_point' __table_args__ = ( sqlalchemy.PrimaryKeyConstraint('entity_id', @@ -198,9 +198,9 @@ class StackLock(BASE, HeatBase): class UserCreds(BASE, HeatBase): - """ - Represents user credentials and mirrors the 'context' - handed in by wsgi. + """Represents user credentials. + + Also, mirrors the 'context' handed in by wsgi. """ __tablename__ = 'user_creds' @@ -347,9 +347,10 @@ class WatchData(BASE, HeatBase): class SoftwareConfig(BASE, HeatBase): - """ - Represents a software configuration resource to be applied to - one or more servers. + """Represents a software configuration resource. + + Represents a software configuration resource to be applied to one or more + servers. """ __tablename__ = 'software_config' @@ -364,9 +365,10 @@ class SoftwareConfig(BASE, HeatBase): class SoftwareDeployment(BASE, HeatBase, StateAware): - """ - Represents applying a software configuration resource to a - single server resource. + """Represents a software deployment resource. + + Represents applying a software configuration resource to a single server + resource. """ __tablename__ = 'software_deployment' diff --git a/heat/db/sqlalchemy/utils.py b/heat/db/sqlalchemy/utils.py index 049af6101..a6a12f5cf 100644 --- a/heat/db/sqlalchemy/utils.py +++ b/heat/db/sqlalchemy/utils.py @@ -18,9 +18,7 @@ import sqlalchemy def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={}, ignorecons=[]): - """ - helper function that clones parent table schema onto - new table. + """Helper function that clones parent table schema onto new table. :param name: new table name :param parent: parent table to copy schema from |