Giter VIP home page Giter VIP logo

Comments (8)

farshidtz avatar farshidtz commented on September 24, 2024 1

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.

farshidtz avatar farshidtz commented on September 24, 2024 1

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.

farshidtz avatar farshidtz commented on September 24, 2024 1

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.

MonicaisHer avatar MonicaisHer commented on September 24, 2024

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.

farshidtz avatar farshidtz commented on September 24, 2024

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.

MonicaisHer avatar MonicaisHer commented on September 24, 2024
	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.

farshidtz avatar farshidtz commented on September 24, 2024

Need to report on Snapd's issue tracker.

from edgex-snap-hooks.

MonicaisHer avatar MonicaisHer commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.