Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gvm/protocols/gmp/_gmpnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,15 @@ def get_agent_support_bundle(
self,
agent_id: EntityID,
days: int = 0,
encryption: bool = True,
) -> T:
"""Request a support bundle for an agent.

Args:
agent_id: ID of the agent to get the support bundle for.
days: Number of days of logs to include. If None, zero is sent so the
Agent Controller uses its configured default.
encryption: Whether an encrypted or plain support bundle is requested.

Raises:
RequiredArgument: If agent_id is missing.
Expand All @@ -330,6 +332,7 @@ def get_agent_support_bundle(
Agents.get_agent_support_bundle(
agent_id,
days=days,
encryption=encryption,
)
)

Expand Down
3 changes: 3 additions & 0 deletions gvm/protocols/gmp/requests/next/_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,15 @@ def get_agent_support_bundle(
agent_id: EntityID,
*,
days: int = 0,
encryption: bool = True,
) -> Request:
"""Request a support bundle for an agent.

Args:
agent_id: ID of the agent to get the support bundle for.
days: Number of days of logs to include. If None, zero is sent so the
Agent Controller uses its configured default.
encryption: Whether an encrypted or plain support bundle is requested.

Raises:
RequiredArgument: If agent_id is missing.
Expand All @@ -462,5 +464,6 @@ def get_agent_support_bundle(
cmd = XmlCommand("get_agent_support_bundle")
cmd.set_attribute("agent_uuid", str(agent_id))
cmd.set_attribute("days", str(days))
cmd.set_attribute("encryption", to_bool(encryption))

return cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_get_agent_support_bundle(self):
)

self.connection.send.has_been_called_with(
b'<get_agent_support_bundle agent_uuid="agent-123" days="7"/>'
b'<get_agent_support_bundle agent_uuid="agent-123" days="7" encryption="1"/>'
)

def test_get_agent_support_bundle_without_days_uses_zero(self):
Expand All @@ -22,7 +22,7 @@ def test_get_agent_support_bundle_without_days_uses_zero(self):
)

self.connection.send.has_been_called_with(
b'<get_agent_support_bundle agent_uuid="agent-123" days="0"/>'
b'<get_agent_support_bundle agent_uuid="agent-123" days="0" encryption="1"/>'
)

def test_get_agent_support_bundle_with_zero_days(self):
Expand All @@ -32,7 +32,18 @@ def test_get_agent_support_bundle_with_zero_days(self):
)

self.connection.send.has_been_called_with(
b'<get_agent_support_bundle agent_uuid="agent-123" days="0"/>'
b'<get_agent_support_bundle agent_uuid="agent-123" days="0" encryption="1"/>'
)

def test_get_agent_support_bundle_with_zero_days_false_encryption(self):
self.gmp.get_agent_support_bundle(
agent_id="agent-123",
days=0,
encryption=False,
)

self.connection.send.has_been_called_with(
b'<get_agent_support_bundle agent_uuid="agent-123" days="0" encryption="0"/>'
)

def test_get_agent_support_bundle_without_agent_id(self):
Expand Down