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

code review PR #5

Open
wants to merge 56 commits into
base: empty
Choose a base branch
from
Open

code review PR #5

wants to merge 56 commits into from

Conversation

markus2330
Copy link
Contributor

This PR is only for a code review, do not merge it.

The new `purge_meta_keys` attribue allows to fully manage metadata
keys, which means, that unspecified metadata keys are now removed,
this attribue is set to true.

Comments are now managed in a much better way, which allows adding
and removing comments.

Still an open issue: when and which comment character should be
used? Currently hard coded to '#'
for both: Type kdbkey and provider kdbkey/ruby
implement the first version of kdbmount resource. The kdb provider
uses 'kdb' tool to mount and umount files. Currently is very limited.
We only support create, destroy and updates to the file path.
Changes to plugin settings are not detected.
if prefix is used, otherwise Puppet will display the 'old' unprefixed
name in logs only. Can be confusing.
we now can add 'check's to a key, whereas we add them to the
spec namespace of the corresponding key.

Do a restructure of the test cases. Now we use the very same
tests for both kdbkey provider.
autorequire all possible kdbmounts this key can be affected by
enum requires to have the last array index set for its root key
e.g.
check/enum/#0 = one
check/enum/#1 = two
check/enum = #1      <====
Allow to manage Elektra array values. Elektra uses the following
format for storing array values:
.../key =
.../key/#0 = first
.../key/#1 = second
...

When passing an array to the kdbkey value property, update the
associated key to reflect this array value (and vice versa).
BernhardDenner and others added 24 commits March 21, 2017 16:44
If an exception occurs only set the error message, do not print any
warnings, since the warnings could be misleading because usually
warnings are not associated with the manipulated key.
convert single array to string
This ensures, that the check can be performed even if the spec_key is
just created (in the same kdb.set operation).
Otherwise we could end up creating keys with invalid values
This gives us automatically an order relation ship between parent and
child key names (section before key)
Now we carfully check which plugins are currenlty used for mounting
the config file and which plugins should really be used.
handle comments both for 'hosts' and 'ini' style comment metadata.
fix array index names for elements >= 10
Copy link
Contributor Author

@markus2330 markus2330 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a short review over some parts...

Looks very nice, some parts are better than others, though.

Maybe you can do a release after a bit of cleanup?

## Description

Puppet module for *libelektra* (https://www.libelektra.org). This allows
key-value based configuration manipulation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key-value-based


* `check`: Add value validation.

This property allows to define certain restrictions to be applied on the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows us

validate do |name|
unless name.nil? or name.empty?
unless name =~ /^(\/|spec|proc|dir|user|system)/
raise ArgumentError, "'%s' is not a valid basename" % name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error is confusing, why basename? do you mean namespace?

It would be better if you get the list of namespaces from the binding (and in the binding from a loop using keyGetNamespace)


Note: for each 'check/xxx' metadata, required by the Elektra plugins, just
remove the 'check/' part and add it to the 'check' property here.
(e.g. validation plugin: 'check/validation' => 'validation' ...)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to doc/METADATA.ini


## Release Notes

Currently the 'libelektra' Puppet module is under heavy development. No releases
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about releasing the current version?


kdbmount { 'user/test/mm':
file => 'mmtest.json',
#file => 'mmtest.ini',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of the file is misleading?

end
end

def flush
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some code comments would be splendid

validate do |name|
if resource[:prefix].nil? or resource[:prefix].empty?
unless name =~ /^(spec|proc|dir|user|system)?\/.+/
raise ArgumentError, "'%s' is not a valid libelektra key name" % name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again...

@@ -0,0 +1,15 @@
{
"name": "libelektra-libelektra",
"version": "0.8.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it is released after all ;)

@@ -0,0 +1,15 @@
{
"name": "libelektra-libelektra",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct name?

@markus2330
Copy link
Contributor Author

Good to see you work on these issues!

But I think you pushed on a wrong branch?
This PR is only for review, not to be worked on.

@markus2330
Copy link
Contributor Author

@MasterToney, fixing this might help you getting into the work.

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

Successfully merging this pull request may close these issues.

2 participants