diff --git a/tacker/api/extensions.py b/tacker/api/extensions.py index 8e825146f..676210209 100644 --- a/tacker/api/extensions.py +++ b/tacker/api/extensions.py @@ -245,7 +245,7 @@ class ExtensionController(wsgi.Controller): def show(self, request, id): # NOTE(dprince): the extensions alias is used as the 'id' for show - ext = self.extension_manager.extensions.get(id, None) + ext = self.extension_manager.extensions.get(id) if not ext: raise webob.exc.HTTPNotFound( _("Extension with alias %s does not exist") % id) @@ -482,7 +482,7 @@ class ExtensionManager(object): extended_attrs = ext.get_extended_resources(version) for resource, resource_attrs in six.iteritems( extended_attrs): - if attr_map.get(resource, None): + if attr_map.get(resource): attr_map[resource].update(resource_attrs) else: attr_map[resource] = resource_attrs diff --git a/tacker/nfvo/drivers/vim/openstack_driver.py b/tacker/nfvo/drivers/vim/openstack_driver.py index f04e25e74..48f99f47a 100644 --- a/tacker/nfvo/drivers/vim/openstack_driver.py +++ b/tacker/nfvo/drivers/vim/openstack_driver.py @@ -68,8 +68,8 @@ class OpenStack_Driver(abstract_vim_driver.VimAbstractDriver): if keystone_version not in auth_url: vim_obj['auth_url'] = auth_url + '/' + keystone_version if keystone_version == 'v3': - auth_cred['project_id'] = vim_project.get('id', None) - auth_cred['project_name'] = vim_project.get('name', None) + auth_cred['project_id'] = vim_project.get('id') + auth_cred['project_name'] = vim_project.get('name') if 'project_domain_id' not in auth_cred: auth_cred[ 'project_domain_id' @@ -79,8 +79,8 @@ class OpenStack_Driver(abstract_vim_driver.VimAbstractDriver): 'user_domain_id' ] = CONF.keystone_authtoken.user_domain_id else: - auth_cred['tenant_id'] = vim_project.get('id', None) - auth_cred['tenant_name'] = vim_project.get('name', None) + auth_cred['tenant_id'] = vim_project.get('id') + auth_cred['tenant_name'] = vim_project.get('name') # user_id is not supported in keystone v2 auth_cred.pop('user_id', None) auth_cred['auth_url'] = vim_obj['auth_url'] diff --git a/tacker/openstack/common/log.py b/tacker/openstack/common/log.py index 8bd86cc77..b07772dc2 100644 --- a/tacker/openstack/common/log.py +++ b/tacker/openstack/common/log.py @@ -568,7 +568,7 @@ class ContextFormatter(logging.Formatter): if key not in record.__dict__: record.__dict__[key] = '' - if record.__dict__.get('request_id', None): + if record.__dict__.get('request_id'): self._fmt = CONF.logging_context_format_string else: self._fmt = CONF.logging_default_format_string diff --git a/tacker/vm/monitor.py b/tacker/vm/monitor.py index d0637e42f..1f115554f 100644 --- a/tacker/vm/monitor.py +++ b/tacker/vm/monitor.py @@ -260,7 +260,7 @@ class ActionRespawnHeat(ActionPolicy): new_device[key] = device_dict[key] LOG.debug(_('new_device %s'), new_device) placement_attr = device_dict.get('placement_attr', {}) - region_name = placement_attr.get('region_name', None) + region_name = placement_attr.get('region_name') # kill heat stack heatclient = heat.HeatClient(auth_attr=auth_attr, region_name=region_name) diff --git a/tacker/vm/plugin.py b/tacker/vm/plugin.py index 910481779..dc0424a4d 100644 --- a/tacker/vm/plugin.py +++ b/tacker/vm/plugin.py @@ -294,7 +294,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin): } new_status = constants.ACTIVE placement_attr = device_dict['placement_attr'] - region_name = placement_attr.get('region_name', None) + region_name = placement_attr.get('region_name') try: self._device_manager.invoke( @@ -337,7 +337,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin): instance_id = self._instance_id(device_dict) e = None placement_attr = device_dict['placement_attr'] - region_name = placement_attr.get('region_name', None) + region_name = placement_attr.get('region_name') try: self._device_manager.invoke( driver_name, 'delete_wait', plugin=self, @@ -358,7 +358,7 @@ class VNFMPlugin(vm_db.VNFMPluginDb, VNFMMgmtMixin): driver_name = self._infra_driver_name(device_dict) instance_id = self._instance_id(device_dict) placement_attr = device_dict['placement_attr'] - region_name = placement_attr.get('region_name', None) + region_name = placement_attr.get('region_name') kwargs = { mgmt_constants.KEY_ACTION: mgmt_constants.ACTION_DELETE_DEVICE, mgmt_constants.KEY_KWARGS: {'device': device_dict}, diff --git a/tacker/vm/tosca/utils.py b/tacker/vm/tosca/utils.py index da06813f6..f12f237da 100644 --- a/tacker/vm/tosca/utils.py +++ b/tacker/vm/tosca/utils.py @@ -252,10 +252,10 @@ def get_flavor_dict(template, flavor_extra_input=None): flavor_dict = {} vdus = findvdus(template) for nt in vdus: - flavor_tmp = nt.get_properties().get('flavor', None) + flavor_tmp = nt.get_properties().get('flavor') if flavor_tmp: continue - if nt.get_capabilities().get("nfv_compute", None): + if nt.get_capabilities().get("nfv_compute"): flavor_dict[nt.name] = {} properties = nt.get_capabilities()["nfv_compute"].get_properties() for prop, (hot_prop, default, unit) in \ @@ -328,7 +328,7 @@ def get_image_dict(template): image_dict = {} vdus = findvdus(template) for vdu in vdus: - if not vdu.entity_tpl.get("artifacts", None): + if not vdu.entity_tpl.get("artifacts"): continue artifacts = vdu.entity_tpl["artifacts"] for name, artifact in iteritems(artifacts):