Comments (8)
This is an snap control or snapd issue. IMO, the unset should remove the key-value or set the value to null. Setting it to empty object is problematic because the original value may have been an string.
from edgex-snap-hooks.
WIth this, snap unset doesn't do work anymore.
Maybe some other part of the code is checking if the value is nil
and setting it to the empty object.
from edgex-snap-hooks.
EdgeX does not have any control of what is set and unset. Snapd manages those.
You are testing something different. The behavior is the same:
$ snap set lxd x.y="hi"
$ snap get lxd -d
{
"x": {
"y": "hi"
}
}
$ snap unset lxd x.y
$ snap get lxd -d
{
"x": {}
}
from edgex-snap-hooks.
Agree, I think the snapd set the value to nil anyway. Unset should consider whether the key exists or not first.
https://github.com/snapcore/snapd/blob/master/cmd/snap/cmd_unset.go#L67-L69
from edgex-snap-hooks.
Agree, I think the snapd set the value to nil anyway. Unset should consider whether the key exists or not first. https://github.com/snapcore/snapd/blob/master/cmd/snap/cmd_unset.go#L67-L69
Perhaps it should be deleted instead: delete(patchValues, confKey)
from edgex-snap-hooks.
patchValues := make(map[string]interface{})
for _, confKey := range x.Positional.ConfKeys {
// patchValues[confKey] = nil
delete(patchValues, confKey)
}
WIth this, snap unset doesn't do work anymore.
from edgex-snap-hooks.
Need to report on Snapd's issue tracker.
from edgex-snap-hooks.
It might be an EdgeX specific issue:
$ snap get -d lxd
{}
$ snap unset lxd service-port
$ snap get -d lxd
{}
from edgex-snap-hooks.
Related Issues (20)
- snapctl command error logs not returned to the caller
- Add logging functions with string formatting
- Warn function logs as syslog error
- Rename ProcessOptions to separate the functionality HOT 2
- Not possible to replace or remove env variables using options HOT 1
- Tests should cleanup snap options HOT 2
- Only using `unset apps` and `unset config` together will do the expected `unset apps`' job HOT 2
- Reject dot separator in config keys
- Setting a bad app key removes other keys from env file HOT 1
- Invalid .env files created and processed by snaps HOT 1
- Env files not removed after disabling app options
- Non-config options validation
- Upgrade snaps to use v2.2.0
- Add function to copy a directory
- Fail to write temp env file because of missing directory
- Env file created even when no environment variables are written HOT 2
- Dependency Dashboard
- Upgrade secrets-config snap options wrapper HOT 1
- Remove broken secrets-config wrapper snap options
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edgex-snap-hooks.