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

Can't set value, Did not find key ... #4987

Open
fel115 opened this issue Aug 4, 2023 · 8 comments
Open

Can't set value, Did not find key ... #4987

fel115 opened this issue Aug 4, 2023 · 8 comments

Comments

@fel115
Copy link

fel115 commented Aug 4, 2023

After setting a new key/value to the database, elektra can't find the new created key.

kdb set -v user:/sw/libelektra/opensesame/#0/current/sensors/#0/loc "Weatherstation"; 
kdb get -v user:/sw/libelektra/opensesame/#0/current/sensors/#0/loc; 

opensesame: no process found
Create a new key user:/sw/libelektra/opensesame/#0/current/sensors/#0/loc with string "Weatherstation"
got 49 keys
searching user:/sw/libelektra/opensesame/#0/current/sensors/#0/loc, found: <nothing>
Did not find key 'user:/sw/libelektra/opensesame/#0/current/sensors/#0/loc'

With other values, it worked well. Could this be caused by the second #0?

I also described this issue in this issue of opensesame.

@markus2330
Copy link
Contributor

Thank you for reporting this problem!

#0 are the first entry for arrays, so they have a special meaning.

To make this issue reproducible we probably need a longer example, including the mounting of TOML (probably the bug is related to this).

@atmaxinger do you maybe have an idea?

@fel115
Copy link
Author

fel115 commented Aug 7, 2023

For some reason, it worked today. But then I tried to remove one entry in the array and it removed the whole array. I used kdb rm user:/sw/libelektra/opensesame/#0/current/sensors/locto remove the loc entry.
But mounting works without an error

root@messstation:/home/olimex/opensesame/debian# kdb mount -vv /home/olimex/opensesame/files/opensesame.spec spec:/sw/libelektra/opensesame/#0/current ni
root@messstation:/home/olimex/opensesame/debian# kdb spec-mount -vv /sw/libelektra/opensesame/#0/current
Got mountpoint from spec:/sw/libelektra/opensesame/#0/current with 24 nodes, configfile: opensesame.toml and mountpoint: /sw/libelektra/opensesame/#0/current
root@messstation:/home/olimex/opensesame/debian# kdb mount -vv /home/olimex/opensesame/files/opensesame.state.spec spec:/state/libelektra/opensesame/#0/current ni
root@messstation:/home/olimex/opensesame/debian# kdb spec-mount -vv /state/libelektra/opensesame/#0/current ni
Got mountpoint from spec:/state/libelektra/opensesame/#0/current with 3 nodes, configfile: opensesame.state and mountpoint: /state/libelektra/opensesame/#0/current

TOML files used opensesame.spec and opensesame.stat.spec

@markus2330
Copy link
Contributor

it removed the whole array: this is probably another bug. Please give full descriptions of what exactly you did and only describe one bug per issue.

@fel115
Copy link
Author

fel115 commented Aug 14, 2023

@atmaxinger how can I add an array with kdb editor ..., I don't understand the syntax in this file. Is there any documentation about it? I wasn't able to find one.

@markus2330
Copy link
Contributor

@fel115 you can choose your own syntax, but better use toml to not run into conversation issues. man kdb editor should work, is this missing in our armhf Debian packages?

Btw. As last resort you can also directly edit ~/.config/opensesame.toml

@fel115
Copy link
Author

fel115 commented Aug 14, 2023

@markus2330 Thx, now I was able to open the editor with the toml-format. man kdb editor is working.

I tried to add the array by adding `sensors.#0.loc = "weatherstation" to the ~/.config/opensesame.toml file, but I get this error message:

Validation Syntactic: Line 1~(11:8-11:32): syntax error, unexpected COMMENT, expecting BARE_STRING or LITERAL_STRING or BASIC_STRING

@markus2330
Copy link
Contributor

I think you need to quote "#0", e.g. sensors."#0".loc = "Gaestezimmer". Use git checkout if you messed up the config to start again.

@fel115
Copy link
Author

fel115 commented Aug 14, 2023

I think you need to quote "#0", e.g. sensors."#0".loc = "Gaestezimmer". Use git checkout if you messed up the config to start again.

Perfect, now its working. Thx ☺️

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

No branches or pull requests

2 participants