Skip to content

Commit

Permalink
Add --force-install and --force-initdb options
Browse files Browse the repository at this point in the history
To the 'deploy' sub-command. Fixes EnterpriseDB#132
  • Loading branch information
jt-edb committed Feb 22, 2021
1 parent 7b07375 commit 48f598b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
36 changes: 36 additions & 0 deletions edbdeploy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ def aws_subcommands(aws_subparser):
action='store_true',
help="Do not install the Ansible collection."
)
aws_deploy.add_argument(
'-f', '--force-install',
dest='force_install',
action='store_true',
help="Force components installation."
)
aws_deploy.add_argument(
'-i', '--force-initdb',
dest='force_initdb',
action='store_true',
help="Force Postgres data initialization."
)

# Azure sub-commands and options
def azure_subcommands(azure_subparser):
Expand Down Expand Up @@ -515,6 +527,18 @@ def azure_subcommands(azure_subparser):
action='store_true',
help="Do not install the Ansible collection."
)
azure_deploy.add_argument(
'-f', '--force-install',
dest='force_install',
action='store_true',
help="Force components installation."
)
azure_deploy.add_argument(
'-i', '--force-initdb',
dest='force_initdb',
action='store_true',
help="Force Postgres data initialization."
)

# GCloud sub-commands and options
def gcloud_subcommands(gcloud_subparser):
Expand Down Expand Up @@ -703,6 +727,18 @@ def gcloud_subcommands(gcloud_subparser):
action='store_true',
help="Do not install the Ansible collection."
)
gcloud_deploy.add_argument(
'-f', '--force-install',
dest='force_install',
action='store_true',
help="Force components installation."
)
gcloud_deploy.add_argument(
'-i', '--force-initdb',
dest='force_initdb',
action='store_true',
help="Force Postgres data initialization."
)

# Argcomplete completer
def project_name_completer(prefix, parsed_args, **kwargs):
Expand Down
6 changes: 5 additions & 1 deletion edbdeploy/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def destroy(self):
def deploy(self):
self._check_project_exists()
logging.info("Deploying components for project %s", self.project.name)
self.project.deploy(self.env.no_install_collection)
self.project.deploy(
self.env.no_install_collection,
self.env.force_install,
self.env.force_initdb
)

def display(self):
self._check_project_exists()
Expand Down
6 changes: 4 additions & 2 deletions edbdeploy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def destroy(self):
self.update_state('terraform', 'DESTROYED')
self.update_state('ansible', 'UNKNOWN')

def deploy(self, no_install_collection):
def deploy(self, no_install_collection, force_install, force_initdb):
inventory_data = None
ansible = AnsibleCli(self.project_path)

Expand All @@ -612,7 +612,9 @@ def deploy(self, no_install_collection):
efm_version=self.ansible_vars['efm_version'],
yum_username=self.ansible_vars['yum_username'],
yum_password=self.ansible_vars['yum_password'],
pass_dir=os.path.join(self.project_path, '.edbpass')
pass_dir=os.path.join(self.project_path, '.edbpass'),
force_install=force_install,
force_initdb=force_initdb,
)
if self.ansible_vars.get('pg_data'):
extra_vars.update(dict(
Expand Down

0 comments on commit 48f598b

Please sign in to comment.