Skip to content

duplicate synclink code? #166

@uhthomas

Description

@uhthomas

Describe the bug

Whilst looking at the SyncLink function, I noticed there may be some duplicated code:

https://github.com/jodevsa/wireguard-operator/blob/1d1bef4d0d82c0235dbfba3b665f6ebe5fb4260b/pkg/wireguard/wireguard.go#L136-L142

It looks like we already get the link and set it to up later in the function.

https://github.com/jodevsa/wireguard-operator/blob/1d1bef4d0d82c0235dbfba3b665f6ebe5fb4260b/pkg/wireguard/wireguard.go#L145-L150

https://github.com/jodevsa/wireguard-operator/blob/1d1bef4d0d82c0235dbfba3b665f6ebe5fb4260b/pkg/wireguard/wireguard.go#L167-L169

I didn't remove it at the time because I don't know if this is deliberate, or if it can just be removed. I also wonder if the check for whether or not the link exists a second time makes sense? How could it possibly not exist if we just created it? I wonder if this function should be reworked a bit to simply call itself again after the link is created rather than getting the link multiple times.

To Reproduce

N/A

Expected behavior

N/A

Screenshots

N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions