Skip to content

Can't delete last element of the static map (DHCP Server) #64

@SpikeeBaut

Description

@SpikeeBaut

Hello,
Thanks for your API.
I started to use it this week but I have a little issue.
In my application, I try to delete the connexion betwenn MAC adress and IP adress. To do so I get the DHCP config and remove the element of the satic map I want to.

self.get_config()
for i in range(0, len(self.config["dhcpd"]["lan"]["staticmap"])-1):
    if self.config["dhcpd"]["lan"]["staticmap"][i]["mac"] == mac_to_delete:
        self.config["dhcpd"]["lan"]["staticmap"].pop(i)
self.execute()

It works well but when I want to delete the last element of the static map it doesn't work and I don't have any error. How can I solve this problem ?

Thanks

Thibaut

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions