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

sysctl doesn't work for keys that contain slash, e.g. VLANs #102

Open
jktjkt opened this issue May 14, 2014 · 14 comments
Open

sysctl doesn't work for keys that contain slash, e.g. VLANs #102

jktjkt opened this issue May 14, 2014 · 14 comments
Labels
bug Something isn't working otherproject

Comments

@jktjkt
Copy link

jktjkt commented May 14, 2014

It is OK to have sysctl keys with slashes in them:

[root@potemkin02 ~]# sysctl net.ipv4.conf.bond0/122.rp_filter
net.ipv4.conf.bond0/122.rp_filter = 1

However, it seems that one cannot really apply them. The following Puppet manifest:

    sysctl { 'net.ipv4.conf.bond0/122.rp_filter':
        ensure  => present,
        value   => 2,
        require => Service['network'],
    }

...results in this:

Error: Could not set 'present' on ensure: /augeas/files/etc/sysctl.conf/error/path = /files/etc/sysctl.conf
/augeas/files/etc/sysctl.conf/error/lens = /usr/share/augeas/lenses/dist/sysctl.aug:36.10-.52:
/augeas/files/etc/sysctl.conf/error/message = Malformed child node 'net.ipv4.conf.bond0' at 105:/etc/puppet/environments/test_vlans/modules/vesnicky/manifests/network.pp
Error: Could not set 'present' on ensure: /augeas/files/etc/sysctl.conf/error/path = /files/etc/sysctl.conf
/augeas/files/etc/sysctl.conf/error/lens = /usr/share/augeas/lenses/dist/sysctl.aug:36.10-.52:
/augeas/files/etc/sysctl.conf/error/message = Malformed child node 'net.ipv4.conf.bond0' at 105:/etc/puppet/environments/test_vlans/modules/vesnicky/manifests/network.pp
Wrapped exception:
/augeas/files/etc/sysctl.conf/error/path = /files/etc/sysctl.conf
/augeas/files/etc/sysctl.conf/error/lens = /usr/share/augeas/lenses/dist/sysctl.aug:36.10-.52:
/augeas/files/etc/sysctl.conf/error/message = Malformed child node 'net.ipv4.conf.bond0'
Error: /Stage[main]/Vesnicky::Network/Sysctl[net.ipv4.conf.bond0/122.rp_filter]/ensure: change from absent to present failed: Could not set 'present' on ensure: /augeas/files/etc/sysctl.conf/error/path = /files/etc/sysctl.conf
/augeas/files/etc/sysctl.conf/error/lens = /usr/share/augeas/lenses/dist/sysctl.aug:36.10-.52:
/augeas/files/etc/sysctl.conf/error/message = Malformed child node 'net.ipv4.conf.bond0' at 105:/etc/puppet/environments/test_vlans/modules/vesnicky/manifests/network.pp
@domcleal
Copy link
Contributor

I don't think Augeas itself will support this, as it stores the sysctl name in the label of the node, so it can't contain slashes. We'll need to fix this in Augeas first, which is going to be very disruptive...

@jktjkt
Copy link
Author

jktjkt commented Sep 29, 2014

Is there something I can do to help bring this forward?

@raphink
Copy link
Member

raphink commented Nov 17, 2014

I remember hitting this issue before, and thinking that sysctl should be parsed as subnodes with [/\.] as the separator for levels.

However, this definitely means breaking compatibility for the lens.

I'm opening hercules-team/augeas#176 for this.

@trevor-vaughan
Copy link
Contributor

I don't have an easy way to test this but why not munge the name so that all slashes are escaped in the provider?

@raphink
Copy link
Member

raphink commented Mar 15, 2016

@trevor-vaughan the problem though is down to the Augeas lens here. There is currently no way to set such keys in the lens.

@trevor-vaughan
Copy link
Contributor

That makes sense and I certainly see the issue.

So, this would be a core patch to augeas to allow for the specification of an alternate key separator?

I would vote for a pipe since that tends to be the usual regex alternative that I've seen used.

@raphink
Copy link
Member

raphink commented Mar 15, 2016

@trevor-vaughan ah, you would just remap "/" as "|" in the labels?

@trevor-vaughan
Copy link
Contributor

Yeah, I would give the user the ability to either use '/' or '|' as they desire so long as it is consistent within a given reference.

Alternatively, you could support escapes in keys but that seems hideous and prone to insanity.

@raphink
Copy link
Member

raphink commented Mar 15, 2016

As far as the Augeas lens is concerned, supporting / is not possible in labels, hence my suggestion to make a backward incompatible change.

@trevor-vaughan
Copy link
Contributor

Would it be possible to support both? If '/' is the first character, that's the separator, if '|' is, then that is the separator.

Basically, either should be supported since that gives you a way to ensure that you cover all key cases (ok, except for keys that have both / and | but that's crazy and I don't want to live on those systems).

@raphink
Copy link
Member

raphink commented Mar 15, 2016

It's not possible in tree, but it could be remapped in the provider as you suggested. However, I'm not a big fan of this. | currently means nothing in sysctl, but who knows if it couldn't mean something in future versions? So I'd rather fix the lens properly (which imo means splitting on \.|/)

@raphink
Copy link
Member

raphink commented Mar 15, 2016

@trevor-vaughan when it comes to the lens itself, it would be better to discuss this in hercules-team/augeas#176

@isaiahfrantz
Copy link

Has there been any fixes/workarounds for this issue?

@johnwarburton
Copy link

Please check voxpupuli/puppet-augeasproviders_sysctl#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working otherproject
Projects
None yet
Development

No branches or pull requests

6 participants