diff options
author | Kubi <jean.gaoliang@huawei.com> | 2017-03-01 01:55:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-03-01 01:55:28 +0000 |
commit | 8b04cef881bb5603f91ea89b238b7e51c5207860 (patch) | |
tree | d0ac5f1a66c5b128bb4868b9b07783bfcade36b7 | |
parent | 5699a278956c9deeafb3ec483689d07019048159 (diff) | |
parent | 46125c3ef9fcbbfba72c09ca1f4a5eb7bca655ef (diff) |
Merge "heat: replace dict key checking with .get()"
-rw-r--r-- | yardstick/benchmark/contexts/heat.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index c5c127966..479548b34 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -62,22 +62,19 @@ class HeatContext(Context): """initializes itself from the supplied arguments""" self.name = attrs["name"] - if "user" in attrs: - self._user = attrs["user"] + self._user = attrs.get("user") - if "heat_template" in attrs: - self.template_file = attrs["heat_template"] - self.heat_parameters = attrs.get("heat_parameters", None) + self.template_file = attrs.get("heat_template") + if self.template_file: + self.heat_parameters = attrs.get("heat_parameters") return self.keypair_name = self.name + "-key" self.secgroup_name = self.name + "-secgroup" - if "image" in attrs: - self._image = attrs.get("image") + self._image = attrs.get("image") - if "flavor" in attrs: - self._flavor = attrs.get("flavor") + self._flavor = attrs.get("flavor") self.placement_groups = [PlacementGroup(name, self, pgattrs["policy"]) for name, pgattrs in attrs.get( |