Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community.windows.win_dhcp_lease - Crashes when Chaning Mac on Existing Reservation #512

Open
ai-ryanbess opened this issue Apr 26, 2023 · 0 comments

Comments

@ai-ryanbess
Copy link

ai-ryanbess commented Apr 26, 2023

Confirmed

Can't find devel. Currently running 1.12.0

SUMMARY

When you attempt to change the mac of an existing reservation, the reservation does get updated but the code crashes right after.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

https://docs.ansible.com/ansible/latest/collections/community/windows/win_dhcp_lease_module.html
specifically https://github.com/ansible-collections/community.windows/blob/main/plugins/modules/win_dhcp_lease.ps1
lines 336

ANSIBLE VERSION
2.12.5
COLLECTION VERSION
1.12.0

CONFIGURATION
running from within AAP so not sure how to do this

OS / ENVIRONMENT
STEPS TO REPRODUCE

Create a DHCP reservation just like on the example.

  • name: Ensure DHCP reservation exists
    community.windows.win_dhcp_lease:
    type: reservation
    ip: 192.168.100.205
    scope_id: 192.168.100.0
    mac: 00:B1:8A:D1:5A:1F
    dns_hostname: "{{ ansible_inventory }}"
    description: Testing Server

Now change the mac and run code again. You should see the reservation update in the DHCP mmc but it should crash at line 336

  • name: Ensure DHCP reservation exists
    community.windows.win_dhcp_lease:
    type: reservation
    ip: 192.168.100.205
    scope_id: 192.168.100.0
    mac: 00:B1:8A:D1:5A:1a
    dns_hostname: "{{ ansible_inventory }}"
    description: Testing Server
EXPECTED RESULTS

Expect that the reservation be updated (which it does), have the code not crash and have a before and after output of what changed. In this example the Mac address is the only thing that changed.

ACTUAL RESULTS

"exception": "Failed to get lease information for ClientId f4-39-09-09-2b-1f from DHCP server someserver.\r\nAt line:336 char:32\r\n+ ... servation = Get-DhcpServerv4Lease -ClientId $current_lease.ClientId - ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidType: (f4-39-09-09-2b-1f:root/Microsoft/...cpServerv4Lease) [Get-DhcpServerv4Lease], CimException\r\n + FullyQualifiedErrorId : DHCP 20016,Get-DhcpServerv4Lease\r\n\r\nScriptStackTrace:\r\n\r\n",
"msg": "Unhandled exception while executing module: Failed to get lease information for ClientId f4-39-09-09-2b-1f from DHCP server someserver.",
"_ansible_no_log": false,
"changed": false,
"_ansible_delegated_vars": {
"ansible_host": "someserver",
"ansible_port": 5985,
"ansible_user": "{{ WIN_USERNAME }}",
"ansible_connection": "winrm"
}
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant