Skip to content

Commit 71fe43e

Browse files
authored
Merge pull request #84 from homebysix/redeploy-framework
Add redeploy_management_framework_v1 to ProApi
2 parents 16e1fbc + 685e998 commit 71fe43e

4 files changed

Lines changed: 42 additions & 0 deletions

File tree

docs/reference/models_pro.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ MDM Commands
8888
ShutDownDeviceCommand
8989
SendMdmCommandResponse
9090
RenewMdmProfileResponse
91+
RedeployManagementFrameworkResponse
9192
MdmCommandStatus
9293
MdmCommandStatusClient
9394
MdmCommandStatusClientTypes

src/jamf_pro_sdk/clients/pro_api/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
MdmCommandClientRequest,
3030
MdmCommandRequest,
3131
MdmCommandStatus,
32+
RedeployManagementFrameworkResponse,
3233
RenewMdmProfileResponse,
3334
SendMdmCommand,
3435
SendMdmCommandClientData,
@@ -608,6 +609,28 @@ def renew_mdm_profile_v1(self, udids: List[Union[str, UUID]]) -> RenewMdmProfile
608609
except KeyError:
609610
return RenewMdmProfileResponse(udidsNotProcessed=[])
610611

612+
def redeploy_management_framework_v1(
613+
self, computer_id: Union[int, str]
614+
) -> RedeployManagementFrameworkResponse:
615+
"""Redeploy the Jamf management framework to a computer.
616+
617+
This reinstalls the Jamf binary and management framework on the target computer. It is
618+
useful for client remediation workflows, such as when the management framework becomes
619+
unresponsive or needs to be reinstalled for re-enrollment scenarios.
620+
621+
:param computer_id: The ID of the computer to redeploy the management framework to.
622+
:type computer_id: Union[int, str]
623+
624+
:return: A response containing the device ID and the UUID of the issued command.
625+
:rtype: RedeployManagementFrameworkResponse
626+
"""
627+
resp = self.api_request(
628+
method="post",
629+
resource_path=f"v1/jamf-management-framework/redeploy/{computer_id}",
630+
)
631+
632+
return RedeployManagementFrameworkResponse(**resp.json())
633+
611634
def send_mdm_command_preview(
612635
self,
613636
management_ids: List[Union[str, UUID]],

src/jamf_pro_sdk/models/pro/mdm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,15 @@ class RenewMdmProfileResponse(BaseModel):
485485
udidsNotProcessed: Optional[List[UUID]]
486486

487487

488+
class RedeployManagementFrameworkResponse(BaseModel):
489+
"""The response returned when redeploying the Jamf management framework to a computer."""
490+
491+
model_config = ConfigDict(extra="allow")
492+
493+
deviceId: Optional[str] = None
494+
commandUuid: Optional[str] = None
495+
496+
488497
# MDM Command Status Models
489498

490499

tests/unit/models/test_models_pro_mdm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
MdmCommandRequest,
2525
PlayLostModeSoundCommand,
2626
ProvisioningProfileListCommand,
27+
RedeployManagementFrameworkResponse,
2728
RefreshCellularPlansCommand,
2829
RequestMirroringCommand,
2930
RestartDeviceCommand,
@@ -226,3 +227,11 @@ def test_mdm_command_request_parsing_from_dict():
226227
assert len(request.clientData) == 2
227228
assert request.commandData.commandType == "ERASE_DEVICE"
228229
assert request.commandData.pin == "654321"
230+
231+
232+
def test_redeploy_management_framework_response_parsing():
233+
"""Verify the redeploy management framework response parses from the API JSON."""
234+
raw = {"deviceId": "123", "commandUuid": "4eecc1fb-f52d-48c5-9560-c246b23601d3"}
235+
response = RedeployManagementFrameworkResponse.model_validate(raw)
236+
assert response.deviceId == "123"
237+
assert response.commandUuid == "4eecc1fb-f52d-48c5-9560-c246b23601d3"

0 commit comments

Comments
 (0)