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

[controller] Device name changed by a template is not updated in the device model instance #293

Open
okraits opened this issue Sep 24, 2020 · 7 comments · May be fixed by #305 or openwisp/openwisp-config#119

Comments

@okraits
Copy link
Member

okraits commented Sep 24, 2020

We have a template to change the device hostname based on the location where it's in use:

{
    "system": [
        {
            "config_name": "system",
            "config_value": "system",
            "hostname": "{{ LOCATION_NAME }}"
        }
    ]
}

There's one issue with this, though:

The device name in the device model instance is not updated because:

I think it's a valid usecase to update the device hostname with a template and thus have this change reflected in the device model instance.

@nemesisdesign What do you think?

@nemesifier
Copy link
Member

nemesifier commented Oct 1, 2020

@okraits the flow is unusual, you set the name of the device on openwisp which is then modified by the device itself after it downloads the configuration specified in a template on OpenWISP. It's a bit strange.

Where is LOCATION_NAME coming from? Is surely coming from somewhere isn't? Can't you simply script the name changing in another way that is internal to your application?

@okraits
Copy link
Member Author

okraits commented Oct 1, 2020

@okraits the flow is unusual, you set the name of the device on openwisp which is then modified by the device itself after it downloads the configuration specified in a template on OpenWISP. It's a bit strange.

The flow only uses core functionality of OpenWISP, I wouldn't call that unusual:

  • The device registers itself at the controller
  • the uci configuration on the device (here the hostname) is changed by a template which uses a context variable

IMO the device info on the controller should be updated if any device information present on the controller is outdated, be it the hostname, the firmware version or one of the IPs. Device info on the controller is of no use if it is outdated. The hostname can change if a device is migrated from one location to another one.

Where is LOCATION_NAME coming from? Is surely coming from somewhere isn't?

It's a context variable in the device config on the controller.

Can't you simply script the name changing in another way that is internal to your application?

Why would I want to do that? AFAIK configuration management should be the job of OpenWISP.

@okraits
Copy link
Member Author

okraits commented Oct 5, 2020

@nemesisdesign How can we solve this? I think the implementation wouldn't take much effort - the client needs to send the hostname together with the other infos and the controller needs to take that data and update the device object.

@okraits
Copy link
Member Author

okraits commented Oct 13, 2020

@nemesisdesign I can't wait because I need this to be fixed, so I implemented a fix.

@nemesifier
Copy link
Member

@okraits at the moment I don't feel confident in proceeding with this until I have analyzed it well, the reason is the same as for the feature that allows openwisp-config to collect the full configuration of the controller: many flows change and the impact of these kind of changes can be assessed only with usage, so I suggest you to use your own modifications for now, we can keep this open and collect more feedback.

Maybe the change will not impact the system at all, but I have to dedicate time to testing it and at the moment I am very busy on other fronts which I announced before so I want to focus on those now.

Thank you for your patience.

@okraits
Copy link
Member Author

okraits commented Oct 15, 2021

@nemesisdesign Did you have a chance to test or think about this?

@nemesifier
Copy link
Member

@nemesisdesign Did you have a chance to test or think about this?

I am still focused on delivering the next major release of OpenWISP.

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