Remove None
as a redundant second argument to dict.get()
`dict.get()` returns `None` by default if a key wasn't found. Remove `None` as second argument to avoid redundancy. Change-Id: If08b61fa0719f4b0465118d595bcc9895d1dcaf7
This commit is contained in:
parent
8116484ed3
commit
e1bf4dfdab
@ -116,7 +116,7 @@ class LxcEngine(engine.Engine):
|
||||
start_script = self.config.get("start_script",
|
||||
get_script_path(START_SCRIPT))
|
||||
distribution = self.config["distribution"]
|
||||
release = self.config.get("release", None)
|
||||
release = self.config.get("release")
|
||||
network = self.config.get("start_lxc_network")
|
||||
if network:
|
||||
network = netaddr.IPNetwork(network)
|
||||
|
@ -318,7 +318,7 @@ class LxcProvider(provider.ProviderFactory):
|
||||
else:
|
||||
network = None
|
||||
distribution = self.config.get("distribution", "ubuntu")
|
||||
release = self.config.get("release", None)
|
||||
release = self.config.get("release")
|
||||
|
||||
for server in host_provider.create_servers():
|
||||
config = {"tunnel_to": self.config.get("tunnel_to", []),
|
||||
|
@ -155,7 +155,7 @@ class OpenStackProvider(provider.ProviderFactory):
|
||||
def get_image_uuid(self):
|
||||
"""Get image uuid. Download image if necessary."""
|
||||
|
||||
image_uuid = self.config["image"].get("uuid", None)
|
||||
image_uuid = self.config["image"].get("uuid")
|
||||
if image_uuid:
|
||||
return image_uuid
|
||||
else:
|
||||
@ -187,7 +187,7 @@ class OpenStackProvider(provider.ProviderFactory):
|
||||
return image.id
|
||||
|
||||
def get_userdata(self):
|
||||
userdata = self.config["image"].get("userdata", None)
|
||||
userdata = self.config["image"].get("userdata")
|
||||
return userdata
|
||||
|
||||
def create_keypair(self):
|
||||
@ -205,7 +205,7 @@ class OpenStackProvider(provider.ProviderFactory):
|
||||
return keypair, public_key_path
|
||||
|
||||
def get_nics(self):
|
||||
return self.config.get("nics", None)
|
||||
return self.config.get("nics")
|
||||
|
||||
def create_security_group_and_rules(self):
|
||||
sec_group_name = self.config.get("secgroup_name",
|
||||
|
@ -313,7 +313,7 @@ class FakeManager(object):
|
||||
self.resources_order = []
|
||||
|
||||
def get(self, resource_uuid):
|
||||
return self.cache.get(resource_uuid, None)
|
||||
return self.cache.get(resource_uuid)
|
||||
|
||||
def delete(self, resource_uuid):
|
||||
cached = self.get(resource_uuid)
|
||||
@ -348,7 +348,7 @@ class FakeServerManager(FakeManager):
|
||||
self.images = image_mgr or FakeImageManager()
|
||||
|
||||
def get(self, resource_uuid):
|
||||
server = self.cache.get(resource_uuid, None)
|
||||
server = self.cache.get(resource_uuid)
|
||||
if server is not None:
|
||||
return server
|
||||
raise nova_exceptions.NotFound("Server %s not found" % (resource_uuid))
|
||||
@ -389,7 +389,7 @@ class FakeImageManager(FakeManager):
|
||||
super(FakeImageManager, self).__init__()
|
||||
|
||||
def get(self, resource_uuid):
|
||||
image = self.cache.get(resource_uuid, None)
|
||||
image = self.cache.get(resource_uuid)
|
||||
if image is not None:
|
||||
return image
|
||||
raise exc.HTTPNotFound("Image %s not found" % (resource_uuid))
|
||||
|
@ -89,7 +89,7 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.assertEqual(fake_shares, result)
|
||||
self.clients("manila").shares.list.assert_called_once_with(
|
||||
detailed=params.get("detailed", True),
|
||||
search_opts=params.get("search_opts", None))
|
||||
search_opts=params.get("search_opts"))
|
||||
|
||||
def test__create_share_network(self):
|
||||
fake_sn = mock.Mock()
|
||||
@ -141,7 +141,7 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.assertEqual(fake_share_networks, result)
|
||||
self.clients("manila").share_networks.list.assert_called_once_with(
|
||||
detailed=params.get("detailed", True),
|
||||
search_opts=params.get("search_opts", None))
|
||||
search_opts=params.get("search_opts"))
|
||||
|
||||
@ddt.data(
|
||||
{},
|
||||
@ -158,7 +158,7 @@ class ManilaScenarioTestCase(test.ScenarioTestCase):
|
||||
self.assertEqual(fake_share_servers, result)
|
||||
self.admin_clients(
|
||||
"manila").share_servers.list.assert_called_once_with(
|
||||
search_opts=params.get("search_opts", None))
|
||||
search_opts=params.get("search_opts"))
|
||||
|
||||
@ddt.data("ldap", "kerberos", "active_directory")
|
||||
def test__create_security_service(self, ss_type):
|
||||
|
Loading…
x
Reference in New Issue
Block a user