Merge "added Is_nova_server method to helpers"
authorSteven Wright <sw3588@att.com>
Tue, 24 Sep 2019 14:53:57 +0000 (14:53 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 24 Sep 2019 14:53:57 +0000 (14:53 +0000)
1  2 
ice_validator/tests/helpers.py

@@@ -393,10 -393,7 +393,10 @@@ def unzip(zip_path, target_dir)
      :param zip_path:    path to valid zip file
      :param target_dir:  directory to unzip zip_path
      """
 -    check(zipfile.is_zipfile(zip_path), "{} is not a valid zipfile or does not exist".format(zip_path))
 +    check(
 +        zipfile.is_zipfile(zip_path),
 +        "{} is not a valid zipfile or does not exist".format(zip_path),
 +    )
      archive = zipfile.ZipFile(zip_path)
      if not os.path.exists(target_dir):
          os.makedirs(target_dir, exist_ok=True)
@@@ -415,3 -412,11 +415,11 @@@ def remove(sequence, exclude, key=None)
      key_func = key if key else lambda x: x
      result = (s for s in sequence if key_func(s) not in exclude)
      return set(result) if isinstance(sequence, Set) else list(result)
+ def is_nova_server(resource):
+     """
+     checks resource is a nova server
+     """
+     return isinstance(resource, dict) and "type" in resource and "properties" in resource and resource.get("type") == "OS::Nova::Server"