diff --git a/krkn/scenario_plugins/http_load/__init__.py b/krkn/scenario_plugins/http_load/__init__.py index e69de29b..512079bc 100644 --- a/krkn/scenario_plugins/http_load/__init__.py +++ b/krkn/scenario_plugins/http_load/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2026 The Krkn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/krkn/scenario_plugins/http_load/http_load_scenario_plugin.py b/krkn/scenario_plugins/http_load/http_load_scenario_plugin.py index c55dfedb..12d6ce1b 100644 --- a/krkn/scenario_plugins/http_load/http_load_scenario_plugin.py +++ b/krkn/scenario_plugins/http_load/http_load_scenario_plugin.py @@ -1,3 +1,16 @@ +# Copyright 2026 The Krkn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import base64 import json import logging diff --git a/krkn/scenario_plugins/network_chaos_ng/modules/node_interface_down.py b/krkn/scenario_plugins/network_chaos_ng/modules/node_interface_down.py index eac3eb9a..e714f868 100644 --- a/krkn/scenario_plugins/network_chaos_ng/modules/node_interface_down.py +++ b/krkn/scenario_plugins/network_chaos_ng/modules/node_interface_down.py @@ -1,3 +1,16 @@ +# Copyright 2026 The Krkn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import queue import time from typing import Tuple diff --git a/krkn/scenario_plugins/node_actions/bm_node_scenarios.py b/krkn/scenario_plugins/node_actions/bm_node_scenarios.py index c7264001..2a331ad8 100644 --- a/krkn/scenario_plugins/node_actions/bm_node_scenarios.py +++ b/krkn/scenario_plugins/node_actions/bm_node_scenarios.py @@ -1,4 +1,4 @@ -# Copyright 2025 The Krkn Authors +# Copyright 2026 The Krkn Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ from krkn.scenario_plugins.node_actions.abstract_node_scenarios import ( abstract_node_scenarios, ) import logging +import os import openshift as oc import pyipmi import pyipmi.interfaces @@ -27,8 +28,8 @@ from krkn_lib.utils import get_random_string class BM: def __init__(self, bm_info, user, passwd): - self.user = user - self.passwd = passwd + self.user = user if user else os.environ.get("BMC_USER") + self.passwd = passwd if passwd else os.environ.get("BMC_PASSWORD") self.bm_info = bm_info def get_node_object(self, node_name): @@ -98,14 +99,17 @@ class BM: else: user = self.user passwd = self.passwd - if user is None or passwd is None: + + if not user or not passwd: logging.error( - "Missing IPMI BMI user and/or password for baremetal cloud. " - "Please specify either a global or per-machine user and pass" + "Missing IPMI BMC user and/or password for baremetal cloud. " + "Please specify either in the scenario YAML or via " + "BMC_USER/BMC_PASSWORD environment variables." ) raise RuntimeError( - "Missing IPMI BMI user and/or password for baremetal cloud. " - "Please specify either a global or per-machine user and pass" + "Missing IPMI BMC user and/or password for baremetal cloud. " + "Please specify either in the scenario YAML or via " + "BMC_USER/BMC_PASSWORD environment variables." ) # Establish connection diff --git a/scenarios/openshift/baremetal_node_scenarios.yml b/scenarios/openshift/baremetal_node_scenarios.yml index 684db63d..029395a4 100644 --- a/scenarios/openshift/baremetal_node_scenarios.yml +++ b/scenarios/openshift/baremetal_node_scenarios.yml @@ -1,3 +1,16 @@ +# Copyright 2026 The Krkn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. node_scenarios: - actions: # Node chaos scenarios to be injected - node_stop_start_scenario # Action to run. Supported actions: node_stop, node_restart, node_stop_start etc. Please refer documentation @@ -10,8 +23,8 @@ node_scenarios: parallel: False # Run action on label or node name in parallel or sequential, set to true for parallel cloud_type: bm # Cloud type on which Kubernetes/OpenShift runs. kube_check: True # Run the kubernetes api calls to see if the node gets to a certain state during the node scenario - bmc_user: # For baremetal (bm) cloud type. The default IPMI username. Optional if specified for all machines - bmc_password: # For baremetal (bm) cloud type. The default IPMI password. Optional if specified for all machines + bmc_user: # The default IPMI username. Optional if BMC_USER env var is set or specified per-machine below. + bmc_password: # The default IPMI password. Optional if BMC_PASSWORD env var is set or specified per-machine below. bmc_info: # This section is here to specify baremetal per-machine info, so it is optional if there is no per-machine info. : # The node name for the baremetal machine bmc_addr: # Optional. For baremetal nodes with the IPMI BMC address missing from 'oc get bmh' diff --git a/scripts/check_license.py b/scripts/check_license.py index 3a88a4f3..a8786286 100644 --- a/scripts/check_license.py +++ b/scripts/check_license.py @@ -1,4 +1,17 @@ #!/usr/bin/env python3 +# Copyright 2026 The Krkn Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ License header linter for krkn source files. @@ -21,7 +34,7 @@ import sys from pathlib import Path LICENSE_HEADER = """\ -# Copyright 2025 The Krkn Authors +# Copyright 2026 The Krkn Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,7 +49,7 @@ LICENSE_HEADER = """\ # limitations under the License.""" # Check for the copyright line only — allows year/author variation -LICENSE_MARKER = "# Copyright 2025 The Krkn Authors" +LICENSE_MARKER = "# Copyright 2026 The Krkn Authors" REPO_ROOT = Path(__file__).parent.parent @@ -47,12 +60,13 @@ def is_test_file(path: Path) -> bool: def collect_source_files() -> list[Path]: - return [ - p - for p in REPO_ROOT.rglob("*.py") - if not is_test_file(p) - and not any(part.startswith(".") or part in ("venv", "venv3111", "build", "dist", "__pycache__") for part in p.parts) - ] + source_files = [] + excluded_dirs = {".git", ".github", "venv", "venv3111", "build", "dist", "__pycache__", "tests", "CI"} + for path in REPO_ROOT.rglob("*.py"): + if not any(part in excluded_dirs or part.startswith(".") for part in path.parts): + if not is_test_file(path): + source_files.append(path) + return source_files def has_license(path: Path) -> bool: