Skip to content

Commit 60cbf7a

Browse files
authored
Merge pull request #47 from kevinrizza/raise-exception-for-validate
Raise exception for validate
2 parents 9846084 + 477ecbc commit 60cbf7a

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

operatorcourier/api.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def build_and_verify(source_dir=None, yamls=None, ui_validate_io=False,
5353
if not valid:
5454
bundle = None
5555
logger.error("Bundle failed validation.")
56+
raise ValueError("Resulting bundle is invalid, input yaml is improperly defined.")
5657
else:
5758
bundle = format_bundle(bundle)
5859

@@ -80,17 +81,14 @@ def build_verify_and_push(namespace, repository, revision, token,
8081

8182
bundle = build_and_verify(source_dir, yamls, validation_output=validation_output)
8283

83-
if bundle is not None:
84-
with TemporaryDirectory() as temp_dir:
85-
with open('%s/bundle.yaml' % temp_dir, 'w') as outfile:
86-
yaml.dump(bundle, outfile, default_flow_style=False)
87-
outfile.flush()
84+
bundle = build_and_verify(source_dir, yamls)
85+
86+
with TemporaryDirectory() as temp_dir:
87+
with open('%s/bundle.yaml' % temp_dir, 'w') as outfile:
88+
yaml.dump(bundle, outfile, default_flow_style=False)
89+
outfile.flush()
8890

89-
PushCmd().push(temp_dir, namespace, repository, revision, token)
90-
else:
91-
logger.error("Bundle is invalid. Will not attempt to push.")
92-
raise ValueError(
93-
"Resulting bundle is invalid, input yaml is improperly defined.")
91+
PushCmd().push(temp_dir, namespace, repository, revision, token)
9492

9593

9694
def nest(source_dir, registry_dir):

0 commit comments

Comments
 (0)