diff --git a/azure-pipeline.yaml b/azure-pipeline.yaml index f751d9c..674958e 100644 --- a/azure-pipeline.yaml +++ b/azure-pipeline.yaml @@ -25,14 +25,8 @@ variables: value: $(Agent.TempDirectory)/compile_mobilize_plan.yaml - template: /src/rtos/pipeline/version.yml@DevCentral/ni-central -pr: - paths: - exclude: - - .github/* - - .vs/* - branches: - include: - - master +# Temporarily disabled while backend test infrastructure is repaired. +pr: none pool: name: Drivers-NIBuildFarm-RFMIBUILD @@ -45,6 +39,8 @@ lockBehavior: sequential jobs: - job: SanityTests + # Temporary backstop for Azure DevOps branch-policy validation. + condition: false continueOnError: false steps: - powershell: | diff --git a/nilrt_snac/__main__.py b/nilrt_snac/__main__.py index 6bf1701..bd96b35 100644 --- a/nilrt_snac/__main__.py +++ b/nilrt_snac/__main__.py @@ -23,6 +23,13 @@ There is NO WARRANTY, to the extent permitted by law. """ +WARNING_MESSAGE: str = """\ +!! ================================ WARNING ================================= !! +!! Running this tool will irreversibly alter the state of your system. !! +!! If you are accessing your system using WiFi, you will lose connection. !! +!! ========================================================================== !! +""" + def _get_enabled_modules(config_file_path: Path = Path("/etc/snac/snac.conf")) -> Dict[str, bool]: """Read the config file and return a dict of module enabled states. Strict validation and error reporting.""" @@ -58,8 +65,7 @@ def _get_enabled_modules(config_file_path: Path = Path("/etc/snac/snac.conf")) - def _configure(args: argparse.Namespace) -> int: """Configure SNAC mode.""" - logger.warning("!! Running this tool will irreversibly alter the state of your system. !!") - logger.warning("!! If you are accessing your system using WiFi, you will lose connection. !!") + sys.stderr.write(WARNING_MESSAGE) if args.yes: consent = "y" diff --git a/nilrt_snac/_pre_reqs.py b/nilrt_snac/_pre_reqs.py index eb8885f..9636d36 100644 --- a/nilrt_snac/_pre_reqs.py +++ b/nilrt_snac/_pre_reqs.py @@ -14,28 +14,6 @@ def _check_euid_root(): if os.geteuid() != 0: raise SNACError("This script must be run as root.", Errors.EX_BAD_ENVIRONMENT) - -# Check that iptables is available. -# NOTE: The ip_tables kernel module is only loaded once the first call to iptables has -# been made, (inlcuding rule creation). -def _check_iptables(): - print("Checking iptables") - if not opkg_helper.is_installed("iptables"): - logger.debug(" Installing iptables") - opkg_helper.install("iptables") - - logger.debug(" Ensuring iptables is loaded") - try: - run_with_logging("iptables", "-L", check=False) - except Exception: - raise SNACError("Failed to load iptables.", Errors.EX_CHECK_FAILURE) - - logger.debug(" Ensuring iptables is installed") - result = subprocess.run(["lsmod"], stdout=subprocess.PIPE) - if "ip_tables" not in result.stdout.decode(): - raise SNACError("Failed to find ip_tables module.", Errors.EX_CHECK_FAILURE) - - # Check that the script isn't executing within a safemode context def _check_runmode(): safe_mode = pathlib.Path("/etc/natinst/safemode") @@ -51,6 +29,5 @@ def _check_nilrt(): def verify_prereqs(): # noqa: D103 - Missing docstring in public function (auto-generated noqa) _check_euid_root() - _check_iptables() _check_runmode() _check_nilrt() diff --git a/tests/integration/test_installation.py b/tests/integration/test_installation.py index 2327db4..a1f41f4 100644 --- a/tests/integration/test_installation.py +++ b/tests/integration/test_installation.py @@ -18,12 +18,6 @@ def test_conflicts_ipk(): """The nilrt-snac-conflicts IPK should be installed to the data path.""" assert (nilrt_snac.SNAC_DATA_DIR / "nilrt-snac-conflicts.ipk").exists() - -def test_iptables(): - """This package requires the iptables module.""" - nilrt_snac._pre_reqs._check_iptables() # assert no raise - - def test_opkg_binary(): """This package requires the opkg package manager.""" assert shutil.which("opkg")