diff options
author | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-08 16:55:15 -0500 |
---|---|---|
committer | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-09 15:47:22 -0500 |
commit | 8088bd4c6617883a1e46b33f08c2a9040f8f57d6 (patch) | |
tree | 79295bff3fb4b22bc14d94f8bf2e9d058d5636db | |
parent | 40e6fc367d4ed8960aac22cc2ce5e0e71bf10ba0 (diff) | |
download | nova-8088bd4c6617883a1e46b33f08c2a9040f8f57d6.tar.gz nova-8088bd4c6617883a1e46b33f08c2a9040f8f57d6.tar.xz nova-8088bd4c6617883a1e46b33f08c2a9040f8f57d6.zip |
fix N402 for nova/db
fixes N402 (single line docstring must end in a period) for nova/db
Change-Id: I31779cbf83fa77c7cc382cce1667812f8cdecd61
-rw-r--r-- | nova/db/api.py | 50 | ||||
-rw-r--r-- | nova/db/sqlalchemy/api.py | 38 | ||||
-rw-r--r-- | nova/db/sqlalchemy/models.py | 32 | ||||
-rw-r--r-- | nova/db/sqlalchemy/session.py | 6 |
4 files changed, 63 insertions, 63 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index b9f188a45..27bb6bf35 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -79,7 +79,7 @@ class NoMoreNetworks(exception.NovaException): class NoMoreTargets(exception.NovaException): - """No more available targets""" + """No more available targets.""" pass @@ -246,7 +246,7 @@ def floating_ip_get(context, id): def floating_ip_get_pools(context): - """Returns a list of floating ip pools""" + """Returns a list of floating ip pools.""" return IMPL.floating_ip_get_pools(context) @@ -335,12 +335,12 @@ def floating_ip_get_by_address(context, address): def floating_ip_get_by_fixed_address(context, fixed_address): - """Get a floating ips by fixed address""" + """Get a floating ips by fixed address.""" return IMPL.floating_ip_get_by_fixed_address(context, fixed_address) def floating_ip_get_by_fixed_ip_id(context, fixed_ip_id): - """Get a floating ips by fixed address""" + """Get a floating ips by fixed address.""" return IMPL.floating_ip_get_by_fixed_ip_id(context, fixed_ip_id) @@ -350,7 +350,7 @@ def floating_ip_update(context, address, values): def floating_ip_set_auto_assigned(context, address): - """Set auto_assigned flag to floating ip""" + """Set auto_assigned flag to floating ip.""" return IMPL.floating_ip_set_auto_assigned(context, address) @@ -360,17 +360,17 @@ def dnsdomain_list(context): def dnsdomain_register_for_zone(context, fqdomain, zone): - """Associated a DNS domain with an availability zone""" + """Associated a DNS domain with an availability zone.""" return IMPL.dnsdomain_register_for_zone(context, fqdomain, zone) def dnsdomain_register_for_project(context, fqdomain, project): - """Associated a DNS domain with a project id""" + """Associated a DNS domain with a project id.""" return IMPL.dnsdomain_register_for_project(context, fqdomain, project) def dnsdomain_unregister(context, fqdomain): - """Purge associations for the specified DNS zone""" + """Purge associations for the specified DNS zone.""" return IMPL.dnsdomain_unregister(context, fqdomain) @@ -513,7 +513,7 @@ def virtual_interface_create(context, values): def virtual_interface_get(context, vif_id): - """Gets a virtual interface from the table,""" + """Gets a virtual interface from the table.""" return IMPL.virtual_interface_get(context, vif_id) @@ -551,7 +551,7 @@ def virtual_interface_delete_by_instance(context, instance_id): def virtual_interface_get_all(context): - """Gets all virtual interfaces from the table""" + """Gets all virtual interfaces from the table.""" return IMPL.virtual_interface_get_all(context) @@ -657,7 +657,7 @@ def instance_get_floating_address(context, instance_id): def instance_floating_address_get_all(context, instance_uuid): - """Get all floating ip addresses of an instance""" + """Get all floating ip addresses of an instance.""" return IMPL.instance_floating_address_get_all(context, instance_uuid) @@ -867,7 +867,7 @@ def network_get_by_uuid(context, uuid): def network_get_by_cidr(context, cidr): - """Get a network by cidr or raise if it does not exist""" + """Get a network by cidr or raise if it does not exist.""" return IMPL.network_get_by_cidr(context, cidr) @@ -1069,12 +1069,12 @@ def ec2_snapshot_create(context, snapshot_id, forced_id=None): def block_device_mapping_create(context, values): - """Create an entry of block device mapping""" + """Create an entry of block device mapping.""" return IMPL.block_device_mapping_create(context, values) def block_device_mapping_update(context, bdm_id, values): - """Update an entry of block device mapping""" + """Update an entry of block device mapping.""" return IMPL.block_device_mapping_update(context, bdm_id, values) @@ -1085,7 +1085,7 @@ def block_device_mapping_update_or_create(context, values): def block_device_mapping_get_all_by_instance(context, instance_uuid): - """Get all block device mapping belonging to an instance""" + """Get all block device mapping belonging to an instance.""" return IMPL.block_device_mapping_get_all_by_instance(context, instance_uuid) @@ -1484,7 +1484,7 @@ def instance_type_extra_specs_update_or_create(context, flavor_id, def vol_get_usage_by_time(context, begin): - """Return volumes usage that have been updated after a specified time""" + """Return volumes usage that have been updated after a specified time.""" return IMPL.vol_get_usage_by_time(context, begin) @@ -1502,17 +1502,17 @@ def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, def s3_image_get(context, image_id): - """Find local s3 image represented by the provided id""" + """Find local s3 image represented by the provided id.""" return IMPL.s3_image_get(context, image_id) def s3_image_get_by_uuid(context, image_uuid): - """Find local s3 image represented by the provided uuid""" + """Find local s3 image represented by the provided uuid.""" return IMPL.s3_image_get_by_uuid(context, image_uuid) def s3_image_create(context, image_uuid): - """Create local s3 image represented by provided uuid""" + """Create local s3 image represented by provided uuid.""" return IMPL.s3_image_create(context, image_uuid) @@ -1530,7 +1530,7 @@ def aggregate_get(context, aggregate_id): def aggregate_get_by_host(context, host, key=None): - """Get a list of aggregates that host belongs to""" + """Get a list of aggregates that host belongs to.""" return IMPL.aggregate_get_by_host(context, host, key) @@ -1663,17 +1663,17 @@ def action_event_get_by_id(context, action_id, event_id): def get_ec2_instance_id_by_uuid(context, instance_id): - """Get ec2 id through uuid from instance_id_mappings table""" + """Get ec2 id through uuid from instance_id_mappings table.""" return IMPL.get_ec2_instance_id_by_uuid(context, instance_id) def get_instance_uuid_by_ec2_id(context, ec2_id): - """Get uuid through ec2 id from instance_id_mappings table""" + """Get uuid through ec2 id from instance_id_mappings table.""" return IMPL.get_instance_uuid_by_ec2_id(context, ec2_id) def ec2_instance_create(context, instance_uuid, id=None): - """Create the ec2 id to instance uuid mapping on demand""" + """Create the ec2 id to instance uuid mapping on demand.""" return IMPL.ec2_instance_create(context, instance_uuid, id) @@ -1687,7 +1687,7 @@ def task_log_end_task(context, task_name, errors, message=None, session=None): - """Mark a task as complete for a given host/time period""" + """Mark a task as complete for a given host/time period.""" return IMPL.task_log_end_task(context, task_name, period_beginning, period_ending, @@ -1704,7 +1704,7 @@ def task_log_begin_task(context, task_name, task_items=None, message=None, session=None): - """Mark a task as started for a given host/time period""" + """Mark a task as started for a given host/time period.""" return IMPL.task_log_begin_task(context, task_name, period_beginning, period_ending, diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 8687ab87b..bb6dfc63a 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -481,7 +481,7 @@ def compute_node_search_by_hypervisor(context, hypervisor_match): def _prep_stats_dict(values): - """Make list of ComputeNodeStats""" + """Make list of ComputeNodeStats.""" stats = [] d = values.get('stats', {}) for k, v in d.iteritems(): @@ -541,7 +541,7 @@ def _update_stats(context, new_stats, compute_id, session, prune_stats=False): @require_admin_context def compute_node_update(context, compute_id, values, prune_stats=False): - """Updates the ComputeNode record with the most recent data""" + """Updates the ComputeNode record with the most recent data.""" stats = values.pop('stats', {}) session = get_session() @@ -1344,7 +1344,7 @@ def virtual_interface_delete_by_instance(context, instance_uuid): @require_context def virtual_interface_get_all(context): - """Get all vifs""" + """Get all vifs.""" vif_refs = _virtual_interface_query(context).all() return vif_refs @@ -1933,7 +1933,7 @@ def _instance_update(context, instance_uuid, values, copy_old_instance=False): def instance_add_security_group(context, instance_uuid, security_group_id): - """Associate the given security group with the given instance""" + """Associate the given security group with the given instance.""" sec_group_ref = models.SecurityGroupInstanceAssociation() sec_group_ref.update({'instance_uuid': instance_uuid, 'security_group_id': security_group_id}) @@ -1942,7 +1942,7 @@ def instance_add_security_group(context, instance_uuid, security_group_id): @require_context def instance_remove_security_group(context, instance_uuid, security_group_id): - """Disassociate the given security group from the given instance""" + """Disassociate the given security group from the given instance.""" model_query(context, models.SecurityGroupInstanceAssociation).\ filter_by(instance_uuid=instance_uuid).\ filter_by(security_group_id=security_group_id).\ @@ -2882,7 +2882,7 @@ def volume_get_iscsi_target_num(context, volume_id): @require_context def ec2_volume_create(context, volume_uuid, id=None): - """Create ec2 compatable volume by provided uuid""" + """Create ec2 compatable volume by provided uuid.""" ec2_volume_ref = models.VolumeIdMapping() ec2_volume_ref.update({'uuid': volume_uuid}) if id is not None: @@ -2919,7 +2919,7 @@ def get_volume_uuid_by_ec2_id(context, ec2_id, session=None): @require_context def ec2_snapshot_create(context, snapshot_uuid, id=None): - """Create ec2 compatable snapshot by provided uuid""" + """Create ec2 compatable snapshot by provided uuid.""" ec2_snapshot_ref = models.SnapshotIdMapping() ec2_snapshot_ref.update({'uuid': snapshot_uuid}) if id is not None: @@ -3625,7 +3625,7 @@ def instance_type_get_all(context, inactive=False, filters=None): @require_context def instance_type_get(context, id, session=None): - """Returns a dict describing specific instance_type""" + """Returns a dict describing specific instance_type.""" result = _instance_type_get_query(context, session=session).\ filter_by(id=id).\ first() @@ -3638,7 +3638,7 @@ def instance_type_get(context, id, session=None): @require_context def instance_type_get_by_name(context, name, session=None): - """Returns a dict describing specific instance_type""" + """Returns a dict describing specific instance_type.""" result = _instance_type_get_query(context, session=session).\ filter_by(name=name).\ first() @@ -3651,7 +3651,7 @@ def instance_type_get_by_name(context, name, session=None): @require_context def instance_type_get_by_flavor_id(context, flavor_id, session=None): - """Returns a dict describing specific flavor_id""" + """Returns a dict describing specific flavor_id.""" result = _instance_type_get_query(context, session=session).\ filter_by(flavorid=flavor_id).\ first() @@ -3664,7 +3664,7 @@ def instance_type_get_by_flavor_id(context, flavor_id, session=None): @require_admin_context def instance_type_destroy(context, name): - """Marks specific instance_type as deleted""" + """Marks specific instance_type as deleted.""" session = get_session() with session.begin(): instance_type_ref = instance_type_get_by_name(context, name, @@ -3686,7 +3686,7 @@ def _instance_type_access_query(context, session=None): @require_admin_context def instance_type_access_get_by_flavor_id(context, flavor_id): - """Get flavor access list by flavor id""" + """Get flavor access list by flavor id.""" instance_type_ref = _instance_type_get_query(context).\ filter_by(flavorid=flavor_id).\ first() @@ -3696,7 +3696,7 @@ def instance_type_access_get_by_flavor_id(context, flavor_id): @require_admin_context def instance_type_access_add(context, flavor_id, project_id): - """Add given tenant to the flavor access list""" + """Add given tenant to the flavor access list.""" session = get_session() with session.begin(): instance_type_ref = instance_type_get_by_flavor_id(context, flavor_id, @@ -3724,7 +3724,7 @@ def instance_type_access_add(context, flavor_id, project_id): @require_admin_context def instance_type_access_remove(context, flavor_id, project_id): - """Remove given tenant from the flavor access list""" + """Remove given tenant from the flavor access list.""" session = get_session() with session.begin(): instance_type_ref = instance_type_get_by_flavor_id(context, flavor_id, @@ -4129,7 +4129,7 @@ def instance_type_extra_specs_update_or_create(context, flavor_id, @require_context def vol_get_usage_by_time(context, begin): - """Return volumes usage that have been updated after a specified time""" + """Return volumes usage that have been updated after a specified time.""" return model_query(context, models.VolumeUsage, read_deleted="yes").\ filter(or_(models.VolumeUsage.tot_last_refreshed == None, models.VolumeUsage.tot_last_refreshed > begin, @@ -4207,7 +4207,7 @@ def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, def s3_image_get(context, image_id): - """Find local s3 image represented by the provided id""" + """Find local s3 image represented by the provided id.""" result = model_query(context, models.S3Image, read_deleted="yes").\ filter_by(id=image_id).\ first() @@ -4219,7 +4219,7 @@ def s3_image_get(context, image_id): def s3_image_get_by_uuid(context, image_uuid): - """Find local s3 image represented by the provided uuid""" + """Find local s3 image represented by the provided uuid.""" result = model_query(context, models.S3Image, read_deleted="yes").\ filter_by(uuid=image_uuid).\ first() @@ -4231,7 +4231,7 @@ def s3_image_get_by_uuid(context, image_uuid): def s3_image_create(context, image_uuid): - """Create local s3 image represented by provided uuid""" + """Create local s3 image represented by provided uuid.""" try: s3_image_ref = models.S3Image() s3_image_ref.update({'uuid': image_uuid}) @@ -4681,7 +4681,7 @@ def action_event_get_by_id(context, action_id, event_id): @require_context def ec2_instance_create(context, instance_uuid, id=None): - """Create ec2 compatable instance by provided uuid""" + """Create ec2 compatable instance by provided uuid.""" ec2_instance_ref = models.InstanceIdMapping() ec2_instance_ref.update({'uuid': instance_uuid}) if id is not None: diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index 01251cd42..735ef56e2 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -81,7 +81,7 @@ class NovaBase(object): return n, getattr(self, n) def update(self, values): - """Make the model object behave like a dict""" + """Make the model object behave like a dict.""" for k, v in values.iteritems(): setattr(self, k, v) @@ -172,7 +172,7 @@ class ComputeNodeStat(BASE, NovaBase): class Certificate(BASE, NovaBase): - """Represents a x509 certificate""" + """Represents a x509 certificate.""" __tablename__ = 'certificates' id = Column(Integer, primary_key=True) @@ -321,7 +321,7 @@ class InstanceInfoCache(BASE, NovaBase): class InstanceTypes(BASE, NovaBase): - """Represent possible instance_types or flavor of VM offered""" + """Represent possible instance_types or flavor of VM offered.""" __tablename__ = "instance_types" id = Column(Integer, primary_key=True) name = Column(String(255)) @@ -484,7 +484,7 @@ class Snapshot(BASE, NovaBase): class BlockDeviceMapping(BASE, NovaBase): - """Represents block device mapping that is defined by EC2""" + """Represents block device mapping that is defined by EC2.""" __tablename__ = "block_device_mapping" id = Column(Integer, primary_key=True, autoincrement=True) @@ -521,7 +521,7 @@ class BlockDeviceMapping(BASE, NovaBase): class IscsiTarget(BASE, NovaBase): - """Represents an iscsi target for a given host""" + """Represents an iscsi target for a given host.""" __tablename__ = 'iscsi_targets' __table_args__ = (schema.UniqueConstraint("target_num", "host"), ) id = Column(Integer, primary_key=True) @@ -757,7 +757,7 @@ class Console(BASE, NovaBase): class InstanceMetadata(BASE, NovaBase): - """Represents a user-provided metadata key/value pair for an instance""" + """Represents a user-provided metadata key/value pair for an instance.""" __tablename__ = 'instance_metadata' id = Column(Integer, primary_key=True) key = Column(String(255)) @@ -773,7 +773,7 @@ class InstanceMetadata(BASE, NovaBase): class InstanceSystemMetadata(BASE, NovaBase): - """Represents a system-owned metadata key/value pair for an instance""" + """Represents a system-owned metadata key/value pair for an instance.""" __tablename__ = 'instance_system_metadata' id = Column(Integer, primary_key=True) key = Column(String(255)) @@ -790,7 +790,7 @@ class InstanceSystemMetadata(BASE, NovaBase): class InstanceTypeProjects(BASE, NovaBase): - """Represent projects associated instance_types""" + """Represent projects associated instance_types.""" __tablename__ = "instance_type_projects" id = Column(Integer, primary_key=True) instance_type_id = Column(Integer, ForeignKey('instance_types.id'), @@ -805,7 +805,7 @@ class InstanceTypeProjects(BASE, NovaBase): class InstanceTypeExtraSpecs(BASE, NovaBase): - """Represents additional specs as key/value pairs for an instance_type""" + """Represents additional specs as key/value pairs for an instance_type.""" __tablename__ = 'instance_type_extra_specs' id = Column(Integer, primary_key=True) key = Column(String(255)) @@ -921,7 +921,7 @@ class AgentBuild(BASE, NovaBase): class BandwidthUsage(BASE, NovaBase): - """Cache for instance bandwidth usage data pulled from the hypervisor""" + """Cache for instance bandwidth usage data pulled from the hypervisor.""" __tablename__ = 'bw_usage_cache' id = Column(Integer, primary_key=True, nullable=False) uuid = Column(String(36), nullable=False) @@ -935,7 +935,7 @@ class BandwidthUsage(BASE, NovaBase): class VolumeUsage(BASE, NovaBase): - """Cache for volume usage data pulled from the hypervisor""" + """Cache for volume usage data pulled from the hypervisor.""" __tablename__ = 'volume_usage_cache' id = Column(Integer, primary_key=True, nullable=False) volume_id = Column(String(36), nullable=False) @@ -953,21 +953,21 @@ class VolumeUsage(BASE, NovaBase): class S3Image(BASE, NovaBase): - """Compatibility layer for the S3 image service talking to Glance""" + """Compatibility layer for the S3 image service talking to Glance.""" __tablename__ = 's3_images' id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) uuid = Column(String(36), nullable=False) class VolumeIdMapping(BASE, NovaBase): - """Compatibility layer for the EC2 volume service""" + """Compatibility layer for the EC2 volume service.""" __tablename__ = 'volume_id_mappings' id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) uuid = Column(String(36), nullable=False) class SnapshotIdMapping(BASE, NovaBase): - """Compatibility layer for the EC2 snapshot service""" + """Compatibility layer for the EC2 snapshot service.""" __tablename__ = 'snapshot_id_mappings' id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) uuid = Column(String(36), nullable=False) @@ -1014,14 +1014,14 @@ class InstanceActionEvent(BASE, NovaBase): class InstanceIdMapping(BASE, NovaBase): - """Compatibility layer for the EC2 instance service""" + """Compatibility layer for the EC2 instance service.""" __tablename__ = 'instance_id_mappings' id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) uuid = Column(String(36), nullable=False) class TaskLog(BASE, NovaBase): - """Audit log for background periodic tasks""" + """Audit log for background periodic tasks.""" __tablename__ = 'task_log' id = Column(Integer, primary_key=True, nullable=False, autoincrement=True) task_name = Column(String(255), nullable=False) diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py index 7c52cd36c..9c896ae97 100644 --- a/nova/db/sqlalchemy/session.py +++ b/nova/db/sqlalchemy/session.py @@ -398,7 +398,7 @@ def get_engine(): def synchronous_switch_listener(dbapi_conn, connection_rec): - """Switch sqlite connections to non-synchronous mode""" + """Switch sqlite connections to non-synchronous mode.""" dbapi_conn.execute("PRAGMA synchronous = OFF") @@ -534,7 +534,7 @@ def create_engine(sql_connection): class Query(sqlalchemy.orm.query.Query): - """Subclass of sqlalchemy.query with soft_delete() method""" + """Subclass of sqlalchemy.query with soft_delete() method.""" def soft_delete(self, synchronize_session='evaluate'): return self.update({'deleted': True, 'updated_at': literal_column('updated_at'), @@ -543,7 +543,7 @@ class Query(sqlalchemy.orm.query.Query): class Session(sqlalchemy.orm.session.Session): - """Custom Session class to avoid SqlAlchemy Session monkey patching""" + """Custom Session class to avoid SqlAlchemy Session monkey patching.""" @wrap_db_error def query(self, *args, **kwargs): return super(Session, self).query(*args, **kwargs) |