Skip to content

Conversation

@chrismatteson
Copy link

…ppetlabs/accounts

) {


create_resources(accounts::user, $accounts)
Copy link

Choose a reason for hiding this comment

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

@chrismatteson gross. You have an aversion to puppet 4 iteration?

Copy link
Author

Choose a reason for hiding this comment

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

Lol, well, besides that I generally assumed our goal was probably to maintain 3.x compatibility for this repo for at least the foreseeable future, since accounts::user is already a define type, this took less code to write.

Copy link

Choose a reason for hiding this comment

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

@chrismatteson this repo is specifically designed for use with code manager so it has a hard dependency on 4.x+. Iteration is slightly more code but significantly more readable :)

Copy link
Author

Choose a reason for hiding this comment

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

So... looking at writing this with loops. I'm not quite sure how I make this work with a hash:

$accounts.each |Hash $account| {
accounts::user { $account:
???
}
}

But will this pass all the parameters correctly? I'm guessing it wouldn't? Mind giving me guidance? Thanks.

Copy link

Choose a reason for hiding this comment

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

Here's an example with the host resource.

https://github.com/npwalker/hosts/blob/master/manifests/init.pp

Any parameters that aren't set use default values.

Copy link
Author

Choose a reason for hiding this comment

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

This seems both like a lot more code, and a lot more brittle since this will need to be updated to match any changes to the acceptable parameters.

…ppetlabs/accounts rewrote accounts profile to utilize iteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants