Skip to content

Commit

Permalink
Rm uneeded func
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgianaElena committed Nov 9, 2023
1 parent df2bf91 commit 06d9677
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions deployer/commands/generate/dedicated_cluster/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,6 @@
from deployer.utils.rendering import print_colour


def check_force_overwrite(cluster_name, force):
"""
Check if the force flag is present and print relevant messages to stdout.
If the --force flag was False, return False, otherwise, return True.
"""
if not force:
print_colour(
f"Found existing infrastructure files for cluster {cluster_name}. Use --force if you want to allow this script to overwrite them.",
"red",
)
return False

print_colour(
f"Attention! Found existing infrastructure files for {cluster_name}. They will be overwritten by the --force flag!",
"red",
)

return True


def check_git_status_clean(infra_files):
"""
Check if running `git status` doesn't return any file that the generate command should create/update.
Expand Down Expand Up @@ -72,9 +52,17 @@ def check_before_continuing_with_generate_command(
if not (any(os.path.exists(path) for path in infra_files)):
return True

if not check_force_overwrite(cluster_name, force):
if not force:
print_colour(
f"Found existing infrastructure files for cluster {cluster_name}. Use --force if you want to allow this script to overwrite them.",
"red",
)
return False

print_colour(
f"Attention! Found existing infrastructure files for {cluster_name}. They will be overwritten by the --force flag!",
"red",
)
return True


Expand Down

0 comments on commit 06d9677

Please sign in to comment.