Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Only using unset apps and unset config together will do the expected unset apps' job #43

Closed
MonicaisHer opened this issue Apr 21, 2022 · 2 comments

Comments

@MonicaisHer
Copy link
Contributor

MonicaisHer commented Apr 21, 2022

set app, unset apps, does not work:

$ sudo snap set edgex-device-mqtt apps.device-mqtt.config.service.port=1111
$ sudo snap restart edgex-device-mqtt.device-mqtt

$ sudo snap unset edgex-device-mqtt apps.device-mqtt.config.service.port
$ sudo snap restart edgex-device-mqtt.device-mqtt

$ snap get edgex-device-mqtt -d
{
    "apps": {
        "device-mqtt": {
            "config": {
                "service": {
                    "port": 1111
                }
            }
        }
    }
}
$ journalctl -f | grep device-mqtt |grep "Web server starting"
msg="Web server starting (localhost:1111)"

set app, unset apps and config, work as expected:

$ sudo snap set edgex-device-mqtt apps.device-mqtt.config.service.port=1111
$ sudo snap restart edgex-device-mqtt.device-mqtt

$ sudo snap unset edgex-device-mqtt apps.device-mqtt.config.service.port
$ sudo snap unset edgex-device-mqtt config.service.port
$ sudo snap restart edgex-device-mqtt.device-mqtt

$ snap get edgex-device-mqtt -d
{}
$ journalctl -f | grep device-mqtt |grep "Web server starting"
msg="Web server starting (localhost:59982)" <----------------------------------------default service port

See more details in this PR

@MonicaisHer MonicaisHer changed the title Only using unset apps and unset config together will do the expected unset apps' job. Only using unset apps and unset config together will do the expected unset apps' job Apr 21, 2022
@farshidtz
Copy link
Member

This is because the unset makes the config object empty and as a result the env file never gets emptied:

if options.Config == nil {
log.Debugf("No global configuration settings")
return nil
}

@farshidtz
Copy link
Member

Fixed by #41

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

No branches or pull requests

2 participants