removed excessive call to os.path.exists
os.path.isfile checks for existance anyway so there is no point in checking both isfile and exists Change-Id: Idbc2d22a807d5413db6e27ff0f6b5a87a5af8fa3
This commit is contained in:
@@ -28,7 +28,7 @@ def get_image_schema():
|
|||||||
global IMAGE_SCHEMA
|
global IMAGE_SCHEMA
|
||||||
if IMAGE_SCHEMA is None:
|
if IMAGE_SCHEMA is None:
|
||||||
schema_path = expanduser("~/.glanceclient/image_schema.json")
|
schema_path = expanduser("~/.glanceclient/image_schema.json")
|
||||||
if os.path.exists(schema_path) and os.path.isfile(schema_path):
|
if os.path.isfile(schema_path):
|
||||||
with open(schema_path, "r") as f:
|
with open(schema_path, "r") as f:
|
||||||
schema_raw = f.read()
|
schema_raw = f.read()
|
||||||
IMAGE_SCHEMA = json.loads(schema_raw)
|
IMAGE_SCHEMA = json.loads(schema_raw)
|
||||||
@@ -356,7 +356,7 @@ def get_namespace_schema():
|
|||||||
global NAMESPACE_SCHEMA
|
global NAMESPACE_SCHEMA
|
||||||
if NAMESPACE_SCHEMA is None:
|
if NAMESPACE_SCHEMA is None:
|
||||||
schema_path = expanduser("~/.glanceclient/namespace_schema.json")
|
schema_path = expanduser("~/.glanceclient/namespace_schema.json")
|
||||||
if os.path.exists(schema_path) and os.path.isfile(schema_path):
|
if os.path.isfile(schema_path):
|
||||||
with open(schema_path, "r") as f:
|
with open(schema_path, "r") as f:
|
||||||
schema_raw = f.read()
|
schema_raw = f.read()
|
||||||
NAMESPACE_SCHEMA = json.loads(schema_raw)
|
NAMESPACE_SCHEMA = json.loads(schema_raw)
|
||||||
@@ -495,7 +495,7 @@ def get_resource_type_schema():
|
|||||||
global RESOURCE_TYPE_SCHEMA
|
global RESOURCE_TYPE_SCHEMA
|
||||||
if RESOURCE_TYPE_SCHEMA is None:
|
if RESOURCE_TYPE_SCHEMA is None:
|
||||||
schema_path = expanduser("~/.glanceclient/resource_type_schema.json")
|
schema_path = expanduser("~/.glanceclient/resource_type_schema.json")
|
||||||
if os.path.exists(schema_path) and os.path.isfile(schema_path):
|
if os.path.isfile(schema_path):
|
||||||
with open(schema_path, "r") as f:
|
with open(schema_path, "r") as f:
|
||||||
schema_raw = f.read()
|
schema_raw = f.read()
|
||||||
RESOURCE_TYPE_SCHEMA = json.loads(schema_raw)
|
RESOURCE_TYPE_SCHEMA = json.loads(schema_raw)
|
||||||
|
Reference in New Issue
Block a user