Skip to content

Commit

Permalink
Remove upgrade and upgrade check (#933)
Browse files Browse the repository at this point in the history
* done

* more fixes

* remove file

* fix-tests
  • Loading branch information
NitinAgg authored Aug 16, 2022
1 parent e0b7ed2 commit 15316f4
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 259 deletions.
4 changes: 0 additions & 4 deletions opta/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
from opta.commands.secret import secret
from opta.commands.shell import shell
from opta.commands.show import show
from opta.commands.upgrade import upgrade
from opta.commands.validate import validate
from opta.commands.version import version
from opta.core.upgrade import check_version_upgrade
from opta.crash_reporter import CURRENT_CRASH_REPORTER
from opta.exceptions import UserErrors
from opta.one_time import one_time
Expand Down Expand Up @@ -59,7 +57,6 @@ def cli() -> None:
cli.add_command(version)
cli.add_command(events)
cli.add_command(force_unlock)
cli.add_command(upgrade)
cli.add_command(generate_terraform)
cli.add_command(help)
cli.add_command(show)
Expand Down Expand Up @@ -97,6 +94,5 @@ def cli() -> None:
# NOTE: Statements after the cli() invocation in the try clause are not executed.
# A quick glance at click documentation did not show why that is the case or any workarounds.
# Therefore adding this version check in the finally clause for now.
check_version_upgrade()
if os.environ.get("OPTA_DEBUG") is None:
cleanup_files()
12 changes: 2 additions & 10 deletions opta/commands/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from opta.amplitude import amplitude_client
from opta.cleanup_files import cleanup_files
from opta.commands.local_flag import _clean_tf_folder, _handle_local_flag
from opta.commands.upgrade import _upgrade
from opta.constants import DEV_VERSION, TF_PLAN_PATH, UPGRADE_WARNINGS, VERSION
from opta.core.aws import AWS
from opta.core.azure import Azure
Expand Down Expand Up @@ -334,16 +333,9 @@ def _verify_semver(
old_semver = semver.VersionInfo.parse(old_semver_string)
current_semver = semver.VersionInfo.parse(current_semver_string)
if old_semver > current_semver:
logger.warning(
f"You're trying to run an older version ({current_semver}) of opta (last run with version {old_semver})."
raise Exception(
f"You're trying to run an older version ({current_semver}) of opta (last run with version {old_semver}). Please upgrade before re-running"
)
if not auto_approve:
click.confirm(
"Do you wish to upgrade to the latest version of Opta?", abort=True,
)
_upgrade()
logger.info("Please rerun the command if the upgrade was successful.")
exit(0)

present_modules = [k.aliased_type or k.type for k in layer.modules]

Expand Down
2 changes: 0 additions & 2 deletions opta/commands/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from opta.commands.apply import local_setup
from opta.core.generator import gen_all
from opta.core.terraform import get_terraform_outputs
from opta.core.upgrade import disable_version_upgrade
from opta.layer import Layer
from opta.utils import check_opta_file_exists, json
from opta.utils.clickoptions import (
Expand All @@ -26,7 +25,6 @@ def output(
config: str, env: Optional[str], local: Optional[bool], var: Dict[str, str],
) -> None:
"""Print TF outputs"""
disable_version_upgrade()
config = check_opta_file_exists(config)
if local:
config = local_setup(config, var, None)
Expand Down
54 changes: 0 additions & 54 deletions opta/commands/upgrade.py

This file was deleted.

70 changes: 0 additions & 70 deletions opta/core/upgrade.py

This file was deleted.

7 changes: 0 additions & 7 deletions tests/commands/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,6 @@ def test_verify_semver_all_good(mocker: MockFixture, mocked_layer: Any) -> None:
_verify_semver("0.1.0", "0.2.0", mocked_layer)


def test_verify_semver_older_version(mocker: MockFixture, mocked_layer: Any) -> None:
mock_upgrade = mocker.patch("opta.commands.apply._upgrade")
with pytest.raises(SystemExit):
_verify_semver("0.2.0", "0.1.0", mocked_layer, True)
mock_upgrade.assert_called_once()


def test_verify_semver_upgrade_warning(mocker: MockFixture, mocked_layer: Any) -> None:
mocked_logger = mocker.patch("opta.commands.apply.logger")
mocked_click = mocker.patch("opta.commands.apply.click")
Expand Down
29 changes: 0 additions & 29 deletions tests/commands/test_upgrade.py

This file was deleted.

83 changes: 0 additions & 83 deletions tests/test_upgrade.py

This file was deleted.

0 comments on commit 15316f4

Please sign in to comment.