Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-07-13 23:33:27 +01:00
parent 8f965bbede
commit 184aa4da8f
160 changed files with 742 additions and 1586 deletions

View File

@@ -2,13 +2,13 @@
# AUTO-UPDATE: nix-update --flake --version=branch=master darktable-lua-scripts
pkgs.stdenv.mkDerivation rec {
pname = "lua-scripts";
version = "release-2.0.0-unstable-2025-06-01";
version = "release-2.0.0-unstable-2025-07-05";
src = pkgs.fetchFromGitHub {
owner = "darktable-org";
repo = pname;
rev = "453d744b6938f1bab652bae9745731bfe413d90b";
hash = "sha256-gTbp7cExUnh4CVviaiYZ1eqVhlXwzX/DHKIFgWJe+UE=";
rev = "aed3275943f218e559c58b98579ceafb02e220da";
hash = "sha256-vRE0kxqbjdjwU+S0Eu44ctYulYPgD0XsrTsz1ESq6t0=";
};
installPhase = ''

View File

@@ -92,6 +92,5 @@
ssh-known-hosts-sas-gitlab = import ./ssh/known-hosts/sas/gitlab { inherit pkgs inputs system; };
sas-cacert = import ./sas/cacert { inherit pkgs; };
viya4-ark = import ./sas/viya4-ark { inherit pkgs; };
viya4-orders-cli = import ./sas/viya4-orders-cli { inherit pkgs; };
}

View File

@@ -2,17 +2,17 @@
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-intro-skipper
pkgs.stdenv.mkDerivation rec {
pname = "intro-skipper";
version = "1.10.10.20";
version = "10.11/v1.10.11.2";
src =
let
parts = pkgs.lib.strings.splitString "." version;
major = pkgs.lib.lists.take 2 (pkgs.lib.lists.drop 1 parts);
merged = pkgs.lib.strings.concatStringsSep "." major;
parts = pkgs.lib.strings.splitString "/" version;
major = builtins.elemAt parts 0;
full = builtins.elemAt parts 1;
in
pkgs.fetchzip {
url = "https://github.com/intro-skipper/intro-skipper/releases/download/${merged}/v${version}/intro-skipper-v${version}.zip";
sha256 = "sha256-RlrZkE8108Uj5V90+jw2o5fXb+K+9/hoDcEaSkKLDGg=";
url = "https://github.com/intro-skipper/intro-skipper/releases/download/${major}/${full}/intro-skipper-${full}.zip";
sha256 = "sha256-3orE9jw2LoejeNYltIju1jtxjkHYd/CydDxAxKYcp5U=";
stripRoot = false;
};

View File

@@ -2,13 +2,13 @@
# AUTO-UPDATE: nix-update --flake --version=branch=main linux-firmware-latest
pkgs.stdenvNoCC.mkDerivation rec {
pname = "linux-firmware";
version = "20250627-unstable-2025-06-30";
version = "20250708-unstable-2025-07-08";
src = pkgs.fetchFromGitLab {
owner = "kernel-firmware";
repo = pname;
rev = "e2dad11e8d4b169fdeac476d694d6ef8f2d3b5bf";
hash = "sha256-iCDpWmTV++Cftv8BizWXDAY9xvgqa3ORM41znZ5RbSM=";
rev = "99d64b4f788c16e81b6550ef94f43c6b91cfad2d";
hash = "sha256-TJ97A9I0ipsqgg7ex3pAQgdhDJcLbkNCvuLppt9a07o=";
};
postUnpack = ''

View File

@@ -2,13 +2,13 @@
# AUTO-UPDATE: nix-update --flake prometheus-podman-exporter
pkgs.buildGoModule rec {
pname = "prometheus-podman-exporter";
version = "1.17.1";
version = "1.17.2";
src = pkgs.fetchFromGitHub {
owner = "containers";
repo = "prometheus-podman-exporter";
rev = "v${version}";
hash = "sha256-5+1rGe9xv0ZVkmLr7pCteuN1DA+oozi/GSyQlQikrWA=";
hash = "sha256-TlQQbeYcCTZKF6DUKM+UE8iU9KC5tLpCtee62sNbW8s=";
};
vendorHash = null;

View File

@@ -1,27 +0,0 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake viya4-ark
pkgs.python3Packages.buildPythonPackage rec {
pname = "viya4-ark";
version = "2.1.0";
src = pkgs.fetchFromGitHub {
owner = "sassoftware";
repo = "viya4-ark";
rev = version;
hash = "sha256-avJC7BHVzhwGK5KtLu82IgRzjDGCzcdca1eP1T5ED0M=";
};
patches = [
./fix-setup.patch
./remove-kubeconfig-check.patch
];
propagatedBuildInputs = with pkgs.python3Packages; [
jinja2
pint
requests
pyyaml
ldap3
semantic-version
];
}

View File

@@ -1,364 +0,0 @@
diff --git a/.gitignore b/.gitignore
index 07ae204..28e5e8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@
*.pyo
*.sa
*.so
+*.eggs
+*.__pycache__/
# Logs and databases #
######################
@@ -43,4 +45,4 @@ Thumbs.db
/bin/
build
docker
-/**/.pytest_cache/
\ No newline at end of file
+/**/.pytest_cache/
diff --git a/deployment_report/templates/__init__.py b/deployment_report/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/ldap_validator/library/__init__.py b/ldap_validator/library/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/ldap_validator/library/utils/__init__.py b/ldap_validator/library/utils/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pre_install_report/templates/__init__.py b/pre_install_report/templates/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/setup.cfg b/setup.cfg
index 1c80cb2..4ffdef1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,11 @@
name = viya4-ark
author = SAS Institute Inc.
summary = The SAS Viya Administration Resource Kit (SAS Viya ARK) provides tools and utilities to help SAS customers prepare for and gather information about a SAS Viya platform deployment.
-description-file = README.md
-description-content-type = text/markdown
-home-page = https://github.com/sassoftware/viya4-ark
+description_file = README.md
+description_content_type = text/markdown
+home_page = https://github.com/sassoftware/viya4-ark
license = Apache-2.0
+
+[options.entry_points]
+console_scripts =
+ viya4-ark = viya4_ark:main
diff --git a/setup.py b/setup.py
index d3dd4f5..05cbeb7 100644
--- a/setup.py
+++ b/setup.py
@@ -14,10 +14,14 @@
from setuptools import find_packages, setup
+packages = find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"])
+
setup(
- setup_requires=["pbr"],
- pbr=True,
- licenses_files=["LICENSE"],
- packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
+ setup_requires=[],
+ license_files=["LICENSE"],
+ py_modules=["viya4_ark"],
+ packages=packages,
+ include_package_data=True,
+ package_data={package: ["*"] for package in packages},
python_requires=">=3.6",
)
diff --git a/viya-ark.py b/viya-ark.py
deleted file mode 100644
index 7626a89..0000000
--- a/viya-ark.py
+++ /dev/null
@@ -1,139 +0,0 @@
-####################################################################
-# ### viya-ark.py ###
-####################################################################
-# ### Author: SAS Institute Inc. ###
-####################################################################
-# ###
-# Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. ###
-# All Rights Reserved. ###
-# SPDX-License-Identifier: Apache-2.0 ###
-# ###
-####################################################################
-
-import importlib
-import inspect
-import os
-import pkgutil
-import sys
-
-from viya_ark_library.command import Command
-
-# command line options #
-_HELP_SHORT_OPT_ = "h"
-_HELP_LONG_OPT_ = "help"
-
-# return codes #
-_SUCCESS_RC_ = 0
-_BAD_OPT_RC_ = 1
-
-
-################
-# Main #
-################
-def main(argv: list):
- """
- The main executable method for the viya-ark launcher script.
-
- :param argv: The list of arguments passed at invocation.
- """
- try:
- # get the requested command value #
- command_name = argv[0]
-
- # print the usage and exit, if requested #
- if command_name in (f"-{_HELP_SHORT_OPT_}", f"--{_HELP_LONG_OPT_}"):
- usage(_SUCCESS_RC_)
-
- # convert any dashes in the given command to underscores to align with Pythonic package/module standards #
- command_module_name = command_name.replace("-", "_")
-
- # attempt to import the requested command module #
- imported_module = None
- try:
- imported_module = importlib.import_module(f"{command_module_name}.{command_module_name}")
- except ModuleNotFoundError:
- print()
- print(f"ERROR: Command [{command_name}] not found.")
- usage(_BAD_OPT_RC_)
-
- # find any attributes in the module that implement the Command class using reflection #
- command = None
- for attribute_name in dir(imported_module):
- # get the current module attribute by name #
- attribute = getattr(imported_module, attribute_name)
-
- # if the attribute is: #
- # (1) a class -AND- #
- # (2) a subclass of Command -AND- #
- # (3) not abstract #
- # then the attribute defines a command for the project. #
- if inspect.isclass(attribute) and issubclass(attribute, Command) and not inspect.isabstract(attribute):
- command = attribute
- # the Command implementation was found, the loop can break #
- break
-
- if command is not None:
- # call the Command's run() method to delegate execution to the module, pass all relevant arguments #
- command.run(argv[1:])
- else:
- # if a Command implementation wasn't found, print the usage message #
- print()
- print(f"ERROR: Command [{command_name}] not found.")
- usage(_BAD_OPT_RC_)
-
- except IndexError:
- # if the launcher script wasn't given enough args, print the usage #
- print()
- print("ERROR: A command must be provided.")
- usage(_BAD_OPT_RC_)
-
-
-#################
-# Usage #
-#################
-def usage(exit_code: int):
- """
- Prints the usage statement for the viya-ark launcher script and exits with the provided exit_code.
-
- :param exit_code: The code to return upon exit.
- """
- commands = list()
-
- # walk through all packages parallel to this script #
- paths = [os.path.realpath(os.path.dirname(__file__))]
- for importer, name, is_package in pkgutil.walk_packages(path=paths):
- # skip any objects that are packages (i.e. not modules) #
- if not is_package:
- # import the current module #
- try:
- importlib.import_module(name)
- except ModuleNotFoundError as e:
- # ignore any issues importing pytest, raise any other module import errors
- if e.name != "pytest":
- raise e
-
- for subclass in Command.__subclasses__():
- # create a tuple of command details by calling the command_name() and command_desc() methods #
- command_details = (subclass().command_name(), subclass().command_desc())
- # add the command details to the list of discovered commands #
- commands.append(command_details)
-
- # print the commands as well as the static help command to stdout #
- print()
- print(f"Usage: {os.path.basename(__file__)} <command> [options]")
- print()
- print("Commands:")
- for command in commands:
- print(" {:<30} {}".format(command[0], command[1]))
- help_cmd_display = f"-{_HELP_SHORT_OPT_}, --{_HELP_LONG_OPT_}"
- print(" {:<30} {}".format(help_cmd_display, "Display usage for viya-ark."))
- print()
-
- sys.exit(exit_code)
-
-
-##################
-# __main__ #
-##################
-if __name__ == "__main__":
- main(sys.argv[1:])
diff --git a/viya4_ark.py b/viya4_ark.py
new file mode 100644
index 0000000..1af3b79
--- /dev/null
+++ b/viya4_ark.py
@@ -0,0 +1,136 @@
+####################################################################
+# ### main.py ###
+####################################################################
+# ### Author: SAS Institute Inc. ###
+####################################################################
+# ###
+# Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. ###
+# All Rights Reserved. ###
+# SPDX-License-Identifier: Apache-2.0 ###
+# ###
+####################################################################
+
+import importlib
+import inspect
+import os
+import pkgutil
+import sys
+
+from viya_ark_library.command import Command
+
+# command line options #
+_HELP_SHORT_OPT_ = "h"
+_HELP_LONG_OPT_ = "help"
+
+# return codes #
+_SUCCESS_RC_ = 0
+_BAD_OPT_RC_ = 1
+
+
+################
+# Main #
+################
+def main():
+ """
+ The main executable method for the viya-ark launcher script.
+ """
+ argv = sys.argv[1:]
+
+ if len(argv) == 0:
+ print("ERROR: A command must be provided.")
+ usage(_BAD_OPT_RC_)
+
+ command_name = argv[0]
+
+ # print the usage and exit, if requested #
+ if command_name in (f"-{_HELP_SHORT_OPT_}", f"--{_HELP_LONG_OPT_}"):
+ usage(_SUCCESS_RC_)
+
+ # convert any dashes in the given command to underscores to align with Pythonic package/module standards #
+ command_module_name = command_name.replace("-", "_")
+
+ # attempt to import the requested command module #
+ imported_module = None
+ try:
+ imported_module = importlib.import_module(f"{command_module_name}.{command_module_name}")
+ except ModuleNotFoundError:
+ print()
+ print(f"ERROR: Command [{command_name}] not found.")
+ usage(_BAD_OPT_RC_)
+
+ # find any attributes in the module that implement the Command class using reflection #
+ command = None
+ for attribute_name in dir(imported_module):
+ # get the current module attribute by name #
+ attribute = getattr(imported_module, attribute_name)
+
+ # if the attribute is: #
+ # (1) a class -AND- #
+ # (2) a subclass of Command -AND- #
+ # (3) not abstract #
+ # then the attribute defines a command for the project. #
+ if inspect.isclass(attribute) and issubclass(attribute, Command) and not inspect.isabstract(attribute):
+ command = attribute
+ # the Command implementation was found, the loop can break #
+ break
+
+ if command is not None:
+ # call the Command's run() method to delegate execution to the module, pass all relevant arguments #
+ command.run(argv[1:])
+ else:
+ # if a Command implementation wasn't found, print the usage message #
+ print()
+ print(f"ERROR: Command [{command_name}] not found.")
+ usage(_BAD_OPT_RC_)
+
+
+#################
+# Usage #
+#################
+def usage(exit_code: int):
+ """
+ Prints the usage statement for the viya-ark launcher script and exits with the provided exit_code.
+
+ :param exit_code: The code to return upon exit.
+ """
+ commands = list()
+
+ # walk through all packages parallel to this script #
+ paths = [os.path.realpath(os.path.dirname(__file__))]
+ for importer, name, is_package in pkgutil.walk_packages(path=paths):
+ # skip any objects that are packages (i.e. not modules) #
+ if is_package:
+ continue
+
+ try:
+ importlib.import_module(name)
+ except ModuleNotFoundError as e:
+ # ignore any issues importing pytest, raise any other module import errors
+ if e.name != "pytest":
+ raise e
+
+ for subclass in Command.__subclasses__():
+ # create a tuple of command details by calling the command_name() and command_desc() methods #
+ command_details = (subclass().command_name(), subclass().command_desc())
+ # add the command details to the list of discovered commands #
+ commands.append(command_details)
+
+ # print the commands as well as the static help command to stdout #
+ print()
+ print(f"Usage: {os.path.basename(__file__)} <command> [options]")
+ print()
+ print("Commands:")
+ for command in commands:
+ print(" {:<30} {}".format(command[0], command[1]))
+ help_cmd_display = f"-{_HELP_SHORT_OPT_}, --{_HELP_LONG_OPT_}"
+ print(" {:<30} {}".format(help_cmd_display, "Display usage for viya-ark."))
+ print()
+
+ sys.exit(exit_code)
+
+
+##################
+# __main__ #
+##################
+if __name__ == "__main__":
+ main()
diff --git a/viya_ark_library/templates/__init__.py b/viya_ark_library/templates/__init__.py
new file mode 100644
index 0000000..e69de29

View File

@@ -1,96 +0,0 @@
diff --git a/pre_install_report/library/pre_install_check.py b/pre_install_report/library/pre_install_check.py
index 31b66d8..88a2d96 100644
--- a/pre_install_report/library/pre_install_check.py
+++ b/pre_install_report/library/pre_install_check.py
@@ -218,21 +218,6 @@ class ViyaPreInstallCheck():
output_dir)
return
- def _read_environment_var(self, env_var):
- """
- This method verifies that the KUBECONFIG environment variable is set.
-
- :param env_var: Environment variable to check
- """
- try:
- value_env_var = os.environ[env_var]
- except Exception:
- self.logger.exception("CalledProcessorError")
- print(viya_messages.KUBECONF_ERROR)
- sys.exit(viya_messages.BAD_ENV_RC_)
-
- return value_env_var
-
def _get_nested_info(self, nested_nodes, extracted_nodes, search_key):
try:
diff --git a/pre_install_report/pre_install_report.py b/pre_install_report/pre_install_report.py
index 1379c43..54fbc7e 100644
--- a/pre_install_report/pre_install_report.py
+++ b/pre_install_report/pre_install_report.py
@@ -74,24 +74,6 @@ def _read_config_file(filename):
sys.exit(viya_messages.SET_LIMTS_ERROR_RC_)
-def read_environment_var(env_var):
- """
- This method verifies that the KUBECONFIG environment variable is set.
-
- :param env_var: Environment variable to check
- """
- try:
- value_env_var = os.environ[env_var]
- # Check if specified file exists
- if not os.path.exists(value_env_var):
- print(viya_messages.KUBECONF_FILE_ERROR.format(value_env_var))
- sys.exit(viya_messages.BAD_ENV_RC_)
- except Exception:
- print(viya_messages.KUBECONF_ERROR)
- sys.exit(viya_messages.BAD_ENV_RC_)
- return value_env_var
-
-
class PreInstallReportCommand(Command):
"""
Command implementation for the pre-install command to register
@@ -198,7 +180,6 @@ def main(argv):
sas_logger = ViyaARKLogger(report_log_path, logging_level=logging_level, logger_name="pre_install_logger")
logger = sas_logger.get_logger()
- read_environment_var('KUBECONFIG')
try:
kubectl = Kubectl(namespace=name_space)
diff --git a/pre_install_report/test/test_pre_install_report.py b/pre_install_report/test/test_pre_install_report.py
index ed805ec..f93ec58 100644
--- a/pre_install_report/test/test_pre_install_report.py
+++ b/pre_install_report/test/test_pre_install_report.py
@@ -25,7 +25,6 @@ from pre_install_report.library.pre_install_check import ViyaPreInstallCheck
from pre_install_report.library.pre_install_check_permissions import PreCheckPermissions
from viya_ark_library.jinja2.sas_jinja2 import Jinja2TemplateRenderer
from viya_ark_library.logging import ViyaARKLogger
-from pre_install_report.pre_install_report import read_environment_var
from pre_install_report.library.utils import viya_messages
_SUCCESS_RC_ = 0
@@ -548,20 +547,6 @@ def test_get_calculated_aggregate_memory():
assert str(round(total_calc_memoryGi.to('Gi'), 13)) == '62.5229606628418 Gi'
-def test_kubconfig_file():
- old_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
- os.environ['KUBECONFIG'] = 'blah_nonexistentfile_blah'
- new_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
- assert new_kubeconfig == 'blah_nonexistentfile_blah'
- try:
- read_environment_var('KUBECONFIG')
- except SystemExit as exc:
- assert exc.code == viya_messages.BAD_ENV_RC_
- pass
- finally:
- os.environ['KUBECONFIG'] = str(old_kubeconfig)
-
-
def test_validated_k8s_server_version():
vpc = createViyaPreInstallCheck(viya_k8s_version_min,