def do_command(self): force = self.app.pargs.force delete_application_and_resources = self.app.pargs.all ignore_links = self.app.pargs.ignore_links timeout = self.app.pargs.timeout nohang = self.app.pargs.nohang app_name = self.get_app_name() if delete_application_and_resources: cleanup = not self.app.pargs.region terminateops.delete_app(app_name, force, nohang=nohang, cleanup=cleanup, timeout=timeout) else: env_name = self.get_env_name() if not force: io.echo(prompts['terminate.confirm'].format(env_name=env_name)) io.validate_action(prompts['terminate.validate'], env_name) if terminateops.is_shared_load_balancer(app_name, env_name): alert_message = alerts['sharedlb.terminate'].format( env_name=env_name) io.log_alert(alert_message + '\n') terminateops.terminate(env_name, force_terminate=ignore_links, nohang=nohang, timeout=timeout)
def check_for_cli_update(self, version): label = self.Meta.label if label in ('create', 'deploy', 'status', 'clone', 'config'): if cli_update_exists(version): if self.check_install_script_used(): io.log_alert(strings['base.update_available_script_install']) else: io.log_alert(strings['base.update_available'])
def _alert_custom_platform_version_status(platform_version, alert_message): filters = [{ 'Operator': '=', 'Type': 'PlatformName', 'Values': [platform_version.platform_name] }] siblings = elasticbeanstalk.list_platform_versions(filters=filters) comparable_version = utils.parse_version(platform_version.platform_version) for sibling in siblings: if utils.parse_version( sibling['PlatformVersion']) > comparable_version: io.log_alert(alert_message + '\n') break
def alert_platform_branch_status( branch, branch_deprecated_alert=None, branch_retired_alert=None, ): if not isinstance(branch, PlatformBranch): branch = PlatformBranch(branch_name=branch) branch.hydrate(platform_branch_ops.get_platform_branch_by_name) if branch.is_deprecated: default_alert = alerts['platformbranch.deprecated'] alert_message = branch_deprecated_alert or default_alert io.log_alert(alert_message + '\n') elif branch.is_retired: default_alert = alerts['platformbranch.retired'] alert_message = branch_retired_alert or default_alert io.log_alert(alert_message + '\n')
def _alert_eb_managed_platform_version_status( platform_version, not_recommended_alert, old_alert, ): if platform_version.is_recommended: return platform_branch_name = platform_version.platform_branch_name preferred_version = platform_version_ops.get_preferred_platform_version_for_branch( platform_branch_name) if preferred_version == platform_version: return if preferred_version.is_recommended: io.log_alert(not_recommended_alert + '\n') else: io.log_alert(old_alert + '\n')
def _alert_if_platform_is_older_than_the_latest(env): latest = solution_stack_ops.find_solution_stack_from_string(env.platform.name, find_newer=True) if env.platform != latest: io.log_alert(alerts['platform.old'])
def test_log_alert(self, echo_mock): io.log_alert('hello, world!') echo_mock.assert_called_once_with('Alert:', 'hello, world!')
def check_for_cli_update(self, version): label = self.Meta.label if label in ('create', 'deploy', 'status', 'clone', 'config'): if cli_update_exists(version): io.log_alert(strings['base.update_available'])