Skip to content

Commit 8af4269

Browse files
author
Taniya Mathur
committed
Add --no-validate option to bypass CloudFormation template validation
1 parent aaad43a commit 8af4269

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

publish.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, verbose=False):
5656
self.s3_client = None
5757
self.cf_client = None
5858
self._is_lib_changed = False
59+
self.skip_validation = False
5960

6061
def log_verbose(self, message, style="dim"):
6162
"""Log verbose messages if verbose mode is enabled"""
@@ -118,7 +119,7 @@ def print_usage(self):
118119
"""Print usage information with Rich formatting"""
119120
self.console.print("\n[bold cyan]Usage:[/bold cyan]")
120121
self.console.print(
121-
" python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose]"
122+
" python3 publish.py <cfn_bucket_basename> <cfn_prefix> <region> [public] [--max-workers N] [--verbose] [--no-validate]"
122123
)
123124

124125
self.console.print("\n[bold cyan]Parameters:[/bold cyan]")
@@ -139,6 +140,9 @@ def print_usage(self):
139140
self.console.print(
140141
" [yellow][--verbose, -v][/yellow]: Optional. Enable verbose output for debugging"
141142
)
143+
self.console.print(
144+
" [yellow][--no-validate][/yellow]: Optional. Skip CloudFormation template validation"
145+
)
142146

143147
def check_parameters(self, args):
144148
"""Check and validate input parameters"""
@@ -196,6 +200,11 @@ def check_parameters(self, args):
196200
elif arg in ["--verbose", "-v"]:
197201
# Verbose flag is already handled by Typer, just acknowledge it here
198202
pass
203+
elif arg == "--no-validate":
204+
self.skip_validation = True
205+
self.console.print(
206+
"[yellow]CloudFormation template validation will be skipped[/yellow]"
207+
)
199208
else:
200209
self.console.print(
201210
f"[yellow]Warning: Unknown argument '{arg}' ignored[/yellow]"
@@ -1267,10 +1276,15 @@ def build_main_template(self, webui_zipfile, components_needing_rebuild):
12671276
)
12681277

12691278
# Validate the template
1270-
template_url = f"https://s3.{self.region}.amazonaws.com/{self.bucket}/{templates[0][0]}"
1271-
self.console.print(f"[cyan]Validating template: {template_url}[/cyan]")
1272-
self.cf_client.validate_template(TemplateURL=template_url)
1273-
self.console.print("[green]✅ Template validation passed[/green]")
1279+
if self.skip_validation:
1280+
self.console.print(
1281+
"[yellow]⚠️ Skipping CloudFormation template validation[/yellow]"
1282+
)
1283+
else:
1284+
template_url = f"https://s3.{self.region}.amazonaws.com/{self.bucket}/{templates[0][0]}"
1285+
self.console.print(f"[cyan]Validating template: {template_url}[/cyan]")
1286+
self.cf_client.validate_template(TemplateURL=template_url)
1287+
self.console.print("[green]✅ Template validation passed[/green]")
12741288

12751289
except ClientError as e:
12761290
# Delete checksum on template validation failure

0 commit comments

Comments
 (0)