Skip to content

Commit 5f6e87e

Browse files
committed
Fix documentation error in workflow
1 parent c9639b1 commit 5f6e87e

File tree

2 files changed

+46
-48
lines changed

2 files changed

+46
-48
lines changed

gvm/protocols/gmp/_gmpnext.py

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -122,27 +122,8 @@ def modify_agents(
122122
123123
Args:
124124
agent_ids: List of agent UUIDs to modify.
125-
authorized: Whether the agent is authorized (writes <authorized>1/0</authorized>).
126-
config: Nested config matching the new schema, e.g.:
127-
{
128-
"agent_control": {
129-
"retry": {
130-
"attempts": 6,
131-
"delay_in_seconds": 60,
132-
"max_jitter_in_seconds": 10,
133-
}
134-
},
135-
"agent_script_executor": {
136-
"bulk_size": 2,
137-
"bulk_throttle_time_in_ms": 300,
138-
"indexer_dir_depth": 100,
139-
"scheduler_cron_time": ["0 */12 * * *"], # str or list[str]
140-
},
141-
"heartbeat": {
142-
"interval_in_seconds": 300,
143-
"miss_until_inactive": 1,
144-
},
145-
}
125+
authorized: Whether the agent is authorized.
126+
config: Nested config for Agent Controller.
146127
comment: Optional comment for the change.
147128
"""
148129
return self._send_request_and_transform_response(
@@ -174,28 +155,7 @@ def modify_agent_control_scan_config(
174155
175156
Args:
176157
agent_control_id: The agent control UUID.
177-
config: Nested config, e.g.:
178-
{
179-
"agent_control": {
180-
"retry": {
181-
"attempts": 6,
182-
"delay_in_seconds": 60,
183-
"max_jitter_in_seconds": 10,
184-
}
185-
},
186-
"agent_script_executor": {
187-
"bulk_size": 2,
188-
"bulk_throttle_time_in_ms": 300,
189-
"indexer_dir_depth": 100,
190-
"scheduler_cron_time": ["0 */12 * * *"], # str or list[str]
191-
},
192-
"heartbeat": {
193-
"interval_in_seconds": 300,
194-
"miss_until_inactive": 1,
195-
},
196-
}
197-
Returns:
198-
Request: Prepared XML command.
158+
config: Nested config for Agent Controller.
199159
"""
200160
return self._send_request_and_transform_response(
201161
Agents.modify_agent_control_scan_config(

gvm/protocols/gmp/requests/next/_agents.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,51 @@ class Agents:
1515

1616
@staticmethod
1717
def _add_el(parent, name: str, value) -> None:
18+
"""
19+
Helper to add a sub-element with a value if the value is not None.
20+
21+
Args:
22+
parent: The XML parent element to which the new element is added.
23+
name: Name of the sub-element to create.
24+
value: Value to set as the text of the sub-element. If None, the
25+
element will not be created.
26+
"""
1827
if value is not None:
1928
parent.add_element(name, str(value))
2029

2130
@classmethod
2231
def _append_agent_config(cls, parent, config: Mapping[str, Any]) -> None:
32+
"""
33+
Append an agent configuration block to the given XML parent element.
34+
35+
Expected config structure::
36+
37+
{
38+
"agent_control": {
39+
"retry": {
40+
"attempts": 6,
41+
"delay_in_seconds": 60,
42+
"max_jitter_in_seconds": 10
43+
}
44+
},
45+
"agent_script_executor": {
46+
"bulk_size": 2,
47+
"bulk_throttle_time_in_ms": 300,
48+
"indexer_dir_depth": 100,
49+
"scheduler_cron_time": ["0 */12 * * *"]
50+
},
51+
"heartbeat": {
52+
"interval_in_seconds": 300,
53+
"miss_until_inactive": 1
54+
}
55+
}
56+
57+
Args:
58+
parent: The XML parent element to which the `<config>` element
59+
should be appended.
60+
config: Mapping containing the agent configuration fields to
61+
serialize.
62+
"""
2363
xml_config = parent.add_element("config")
2464

2565
# agent_control.retry
@@ -101,10 +141,10 @@ def modify_agents(
101141
Args:
102142
agent_ids: List of agent UUIDs to modify.
103143
authorized: Whether the agent is authorized.
104-
config: Nested config matching the new schema, e.g.:
144+
config: Nested config, e.g.:
105145
{
106146
"agent_control": {
107-
"retry": {
147+
"retry": {
108148
"attempts": 6,
109149
"delay_in_seconds": 60,
110150
"max_jitter_in_seconds": 10,
@@ -114,7 +154,7 @@ def modify_agents(
114154
"bulk_size": 2,
115155
"bulk_throttle_time_in_ms": 300,
116156
"indexer_dir_depth": 100,
117-
"scheduler_cron_time": ["0 */12 * * *"], # list[str]
157+
"scheduler_cron_time": ["0 */12 * * *"], # str or list[str]
118158
},
119159
"heartbeat": {
120160
"interval_in_seconds": 300,
@@ -196,8 +236,6 @@ def modify_agent_control_scan_config(
196236
"miss_until_inactive": 1,
197237
},
198238
}
199-
Returns:
200-
Request: Prepared XML command.
201239
"""
202240
if not agent_control_id:
203241
raise RequiredArgument(

0 commit comments

Comments
 (0)