Merge "Fix [H405] pep rule in heat/db"
This commit is contained in:
commit
498c66b8dd
@ -11,8 +11,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
'''
|
"""Interface for database access.
|
||||||
Interface for database access.
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ Usage:
|
|||||||
|
|
||||||
The underlying driver is loaded . SQLAlchemy is currently the only
|
The underlying driver is loaded . SQLAlchemy is currently the only
|
||||||
supported backend.
|
supported backend.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import api
|
from oslo_db import api
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
'''Implementation of SQLAlchemy backend.'''
|
"""Implementation of SQLAlchemy backend."""
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -178,9 +178,9 @@ def resource_update(context, resource_id, values, atomic_key,
|
|||||||
|
|
||||||
|
|
||||||
def resource_data_get_all(resource, data=None):
|
def resource_data_get_all(resource, data=None):
|
||||||
"""
|
"""Looks up resource_data by resource.id.
|
||||||
Looks up resource_data by resource.id. If data is encrypted,
|
|
||||||
this method will decrypt the results.
|
If data is encrypted, this method will decrypt the results.
|
||||||
"""
|
"""
|
||||||
if data is None:
|
if data is None:
|
||||||
data = (model_query(resource.context, models.ResourceData)
|
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):
|
def resource_data_get(resource, key):
|
||||||
"""Lookup value of resource's data by key. Decrypts resource data if
|
"""Lookup value of resource's data by key.
|
||||||
necessary.
|
|
||||||
|
Decrypts resource data if necessary.
|
||||||
"""
|
"""
|
||||||
result = resource_data_get_by_key(resource.context,
|
result = resource_data_get_by_key(resource.context,
|
||||||
resource.id,
|
resource.id,
|
||||||
@ -242,8 +243,9 @@ def stack_tags_get(context, stack_id):
|
|||||||
|
|
||||||
|
|
||||||
def resource_data_get_by_key(context, resource_id, key):
|
def resource_data_get_by_key(context, resource_id, key):
|
||||||
"""Looks up resource_data by resource_id and key. Does not unencrypt
|
"""Looks up resource_data by resource_id and key.
|
||||||
resource_data.
|
|
||||||
|
Does not decrypt resource_data.
|
||||||
"""
|
"""
|
||||||
result = (model_query(context, models.ResourceData)
|
result = (model_query(context, models.ResourceData)
|
||||||
.filter_by(resource_id=resource_id)
|
.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):
|
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 sort_keys: an array of strings
|
||||||
:param mapping: a mapping from keys to DB column names
|
:param mapping: a mapping from keys to DB column names
|
||||||
:returns: filtered list of sort keys
|
:returns: filtered list of sort keys
|
||||||
'''
|
"""
|
||||||
if isinstance(sort_keys, six.string_types):
|
if isinstance(sort_keys, six.string_types):
|
||||||
sort_keys = [sort_keys]
|
sort_keys = [sort_keys]
|
||||||
return [mapping[key] for key in sort_keys or [] if key in mapping]
|
return [mapping[key] for key in sort_keys or [] if key in mapping]
|
||||||
|
@ -10,9 +10,8 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""
|
|
||||||
SQLAlchemy models for heat data.
|
"""SQLAlchemy models for heat data."""
|
||||||
"""
|
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -119,6 +118,7 @@ class StackTag(BASE, HeatBase):
|
|||||||
|
|
||||||
class SyncPoint(BASE, HeatBase):
|
class SyncPoint(BASE, HeatBase):
|
||||||
"""Represents an syncpoint for an stack that is being worked on."""
|
"""Represents an syncpoint for an stack that is being worked on."""
|
||||||
|
|
||||||
__tablename__ = 'sync_point'
|
__tablename__ = 'sync_point'
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
sqlalchemy.PrimaryKeyConstraint('entity_id',
|
sqlalchemy.PrimaryKeyConstraint('entity_id',
|
||||||
@ -198,9 +198,9 @@ class StackLock(BASE, HeatBase):
|
|||||||
|
|
||||||
|
|
||||||
class UserCreds(BASE, HeatBase):
|
class UserCreds(BASE, HeatBase):
|
||||||
"""
|
"""Represents user credentials.
|
||||||
Represents user credentials and mirrors the 'context'
|
|
||||||
handed in by wsgi.
|
Also, mirrors the 'context' handed in by wsgi.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = 'user_creds'
|
__tablename__ = 'user_creds'
|
||||||
@ -348,9 +348,10 @@ class WatchData(BASE, HeatBase):
|
|||||||
|
|
||||||
|
|
||||||
class SoftwareConfig(BASE, HeatBase):
|
class SoftwareConfig(BASE, HeatBase):
|
||||||
"""
|
"""Represents a software configuration resource.
|
||||||
Represents a software configuration resource to be applied to
|
|
||||||
one or more servers.
|
Represents a software configuration resource to be applied to one or more
|
||||||
|
servers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = 'software_config'
|
__tablename__ = 'software_config'
|
||||||
@ -365,9 +366,10 @@ class SoftwareConfig(BASE, HeatBase):
|
|||||||
|
|
||||||
|
|
||||||
class SoftwareDeployment(BASE, HeatBase, StateAware):
|
class SoftwareDeployment(BASE, HeatBase, StateAware):
|
||||||
"""
|
"""Represents a software deployment resource.
|
||||||
Represents applying a software configuration resource to a
|
|
||||||
single server resource.
|
Represents applying a software configuration resource to a single server
|
||||||
|
resource.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = 'software_deployment'
|
__tablename__ = 'software_deployment'
|
||||||
|
@ -18,9 +18,7 @@ import sqlalchemy
|
|||||||
|
|
||||||
def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={},
|
def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={},
|
||||||
ignorecons=[]):
|
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 name: new table name
|
||||||
:param parent: parent table to copy schema from
|
:param parent: parent table to copy schema from
|
||||||
|
Loading…
Reference in New Issue
Block a user