Skip to content

Commit c7dc5cd

Browse files
committed
collector args added to sudo plugins
1 parent d34e798 commit c7dc5cd

File tree

10 files changed

+108
-8
lines changed

10 files changed

+108
-8
lines changed

nodescraper/pluginexecutor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,6 @@ def apply_global_args_to_plugin(
240240
for key in global_args:
241241
if key in ["collection_args", "analysis_args"] and isinstance(plugin_inst, DataPlugin):
242242
continue
243-
if key == "skip_sudo" and (global_args[key] or global_args[key] == 1):
244-
global_args["collection_args"]["skip_sudo"] = 1
245243
else:
246244
run_args[key] = global_args[key]
247245

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
###############################################################################
2+
#
3+
# MIT License
4+
#
5+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
###############################################################################
26+
27+
from nodescraper.models import CollectorArgs
28+
29+
30+
class DimmCollectorArgs(CollectorArgs):
31+
skip_sudo = False

nodescraper/plugins/inband/dimm/dimm_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def collect_data(
4040
args=None,
4141
) -> tuple[TaskResult, DimmDataModel | None]:
4242
"""Collect data on installed DIMMs"""
43-
if args and "skip_sudo" in args.keys() and args["skip_sudo"]:
44-
self.resultmessage = "Skipping sudo plugin"
43+
if args.skip_sudo:
44+
self.result.message = "Skipping sudo plugin"
4545
self.result.status = ExecutionStatus.NOT_RAN
4646
return self.result, None
4747
dimm_str = None

nodescraper/plugins/inband/dimm/dimm_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
###############################################################################
2626
from nodescraper.base import InBandDataPlugin
2727

28+
from .collector_args import DimmCollectorArgs
2829
from .dimm_collector import DimmCollector
2930
from .dimmdata import DimmDataModel
3031

@@ -35,3 +36,5 @@ class DimmPlugin(InBandDataPlugin[DimmDataModel, None, None]):
3536
DATA_MODEL = DimmDataModel
3637

3738
COLLECTOR = DimmCollector
39+
40+
COLLECTOR_ARGS = DimmCollectorArgs
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
###############################################################################
2+
#
3+
# MIT License
4+
#
5+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
###############################################################################
26+
27+
from nodescraper.models import CollectorArgs
28+
29+
30+
class DmesgCollectorArgs(CollectorArgs):
31+
skip_sudo = False

nodescraper/plugins/inband/dmesg/dmesg_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def collect_data(
6767
Returns:
6868
tuple[TaskResult, DmesgData | None]: tuple containing the result of the task and the dmesg data if available
6969
"""
70-
if args and "skip_sudo" in args.keys() and args["skip_sudo"]:
71-
self.resultmessage = "Skipping sudo plugin"
70+
if args.skip_sudo:
71+
self.result.message = "Skipping sudo plugin"
7272
self.result.status = ExecutionStatus.NOT_RAN
7373
return self.result, None
7474
dmesg_content = self._get_dmesg_content()

nodescraper/plugins/inband/dmesg/dmesg_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from nodescraper.base import InBandDataPlugin
2727

2828
from .analyzer_args import DmesgAnalyzerArgs
29+
from .collector_args import DmesgCollectorArgs
2930
from .dmesg_analyzer import DmesgAnalyzer
3031
from .dmesg_collector import DmesgCollector
3132
from .dmesgdata import DmesgData
@@ -39,3 +40,5 @@ class DmesgPlugin(InBandDataPlugin[DmesgData, None, DmesgAnalyzerArgs]):
3940
COLLECTOR = DmesgCollector
4041

4142
ANALYZER = DmesgAnalyzer
43+
44+
COLLECTOR_ARGS = DmesgCollectorArgs
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
###############################################################################
2+
#
3+
# MIT License
4+
#
5+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
#
25+
###############################################################################
26+
27+
from nodescraper.models import CollectorArgs
28+
29+
30+
class StorageCollectorArgs(CollectorArgs):
31+
skip_sudo = False

nodescraper/plugins/inband/storage/storage_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class StorageCollector(InBandDataCollector[StorageDataModel, None]):
3939

4040
def collect_data(self, args: None = None) -> tuple[TaskResult, StorageDataModel | None]:
4141
"""read storage usage data"""
42-
if args and "skip_sudo" in args.keys() and args["skip_sudo"]:
43-
self.resultmessage = "Skipping sudo plugin"
42+
if args.skip_sudo:
43+
self.result.message = "Skipping sudo plugin"
4444
self.result.status = ExecutionStatus.NOT_RAN
4545
return self.result, None
4646
storage_data = {}

nodescraper/plugins/inband/storage/storage_plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from nodescraper.base import InBandDataPlugin
2727

2828
from .analyzer_args import StorageAnalyzerArgs
29+
from .collector_args import StorageCollectorArgs
2930
from .storage_analyzer import StorageAnalyzer
3031
from .storage_collector import StorageCollector
3132
from .storagedata import StorageDataModel
@@ -39,3 +40,5 @@ class StoragePlugin(InBandDataPlugin[StorageDataModel, None, StorageAnalyzerArgs
3940
COLLECTOR = StorageCollector
4041

4142
ANALYZER = StorageAnalyzer
43+
44+
COLLECTOR_ARGS = StorageCollectorArgs

0 commit comments

Comments
 (0)