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

Idempotent resources to say 'make a subtree like this' #103

Open
lutter opened this issue May 15, 2014 · 1 comment
Open

Idempotent resources to say 'make a subtree like this' #103

lutter opened this issue May 15, 2014 · 1 comment
Labels
enhancement New feature or request

Comments

@lutter
Copy link

lutter commented May 15, 2014

I've seen a few users now who struggle with using the raw augeas resource to set up a subtree idempotently (and that is a big head scratcher) I agree that ultimately the right answer is to build providers that are targetted at specific uses.

At the same time, it would be awesome to have one (or several) resources that make it easy to ensure that a certain subtree is there idempotently; I am thinking something along the lines of

# Most of this is the regular 'augeas' resource
augeas::tree { sshd_root_login:
  lens => 'Sshd.lns',
  file => ...,
  context => '/files/etc/ssh/sshd_config',
  after => "#comment[.='PermitRootLogin yes']",
  entries => [
    # Here we'd describe what we want the subtree to look like
    "PermitRootLogin = yes"
  ]
}

There's lots of variations on this theme, like should a subtree be deleted if it exists in the wrong place etc.

Since Augeas actually behaves idempotently if you delete and then recreate the exact same subtree, the implementation of such a resource might not be terribly difficult.

@raphink
Copy link
Member

raphink commented May 19, 2014

I think we could have some kind of type/provider using the augeasproviders accessors, coupled with Augeas#store/Augeas#retrieve to map file syntax to tree (like in your example of entries).

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

No branches or pull requests

2 participants