Skip to content

Commit e638d28

Browse files
aalhourjfri3d
authored andcommitted
#61 - allow users to force build local backend after deploy (#65)
1 parent 106633a commit e638d28

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cli/kaos_cli/commands/build.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,18 @@ def build(backend: BackendFacade, cloud, env, force, verbose, yes, local_backend
7878

7979
# validate unused port for DOCKER
8080
if cloud == DOCKER and not validate_unused_port(80):
81-
click.echo(
82-
"{} - Network port {} is used but is needed for building {} backend in {}".format(
83-
click.style("Warning", bold=True, fg='yellow'),
84-
click.style("80", bold=True),
85-
click.style("kaos", bold=True),
86-
click.style(cloud, bold=True, fg='red')))
87-
88-
sys.exit(1)
81+
# If the force build flag was set to True and the kaos backend
82+
# was already built then skip the warning; otherwise, warn
83+
# the user that the port is already taken by another service
84+
# and issue a sys exit
85+
if not (force and backend.is_created()):
86+
click.echo(
87+
"{} - Network port {} is used but is needed for building {} backend in {}".format(
88+
click.style("Warning", bold=True, fg='yellow'),
89+
click.style("80", bold=True),
90+
click.style("kaos", bold=True),
91+
click.style(cloud, bold=True, fg='red')))
92+
sys.exit(1)
8993

9094
try:
9195

0 commit comments

Comments
 (0)