davesteele / comitup

Bootstrap Wifi support over Wifi
https://davesteele.github.io/comitup/
GNU General Public License v2.0
320 stars 54 forks source link

Filter docker devices to add_hosts() #200

Open sebastianeferrer opened 2 years ago

sebastianeferrer commented 2 years ago

I have a conflict between docker and comitup. First approach was to implement comitup callback depending on connection state to stop the docker container that was bodering. Then I found that I needed my docker container running without interruption in case wifi fails so I was trying to figure out what is the function that makes comitup have a conflict with the docker interfaces.

Digging a bit inside the logs in debug mode I found out add_hosts() function trying to add this unwanted docker interfaces.

def add_hosts(hosts: List[str]) -> None:
    establish_group()
    int_mapping = get_interface_mapping()

    devices: Optional[List["NetworkManager.Device"]] = nm.get_devices()

I think that may be replacion nm.get_devices() with nm.get_wifi_devices(), the issue will be solver. Am I in the wrong way or is this correct way?

I really appreciate all the hard work you have done for this proyect and I thank to you!

davesteele commented 2 years ago

If the issue involves networking, I suspect the solution follows along the lines of this.

sebastianeferrer commented 2 years ago

Sorry Dave, I'd posted this issue by mistake, but now I'm editing first comment to explain what it came about. It's about conflict between docker and comitup.

davesteele commented 2 years ago

Good work.

The add_hosts() function is getting a list of network devices for publishing ZeroConf services and mdns records - it needs to list both wired and wireless devices. I can believe that it could have some heartache with devices created by Docker.

I suspect a new function (get_network_endpoints()?) that filters a la get_wifi_devices() to provide a list of "useful" devices.

davesteele commented 2 years ago

Note that Comitup also takes action on loss of a wifi connection.

sebastianeferrer commented 2 years ago

I will try to play with this that you pointed out and I will back with the results. Thanks again for the fast reponse! You are the best!