Skip to content
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.

Add prefix parameters #196

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

TheFlyingCorpse
Copy link
Contributor

Prefix options for etc, var and share, alternatively a generic one for all called dirprefix that is used unless the more specific is used.

@TheFlyingCorpse
Copy link
Contributor Author

Updated the prefix paths based on my previous PR #189 to be more generic and separate from Windows support for a cleaner merge.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch 3 times, most recently from 46c46c7 to 4ac27c6 Compare April 23, 2016 21:07
This was referenced Apr 23, 2016
@arioch
Copy link
Contributor

arioch commented Apr 25, 2016

Looking good so far but I have three remarks before merging.

1:

$target_dir = "${::icinga2::params::etcprefix}/conf.d",

It's cleaner to have it point to ::icinga2::etcprefix and have the init class to take care of the resolving.
This way it's consistent with the kenbarberism pattern we use throughout the module. Shouldn't be too hard to find/replace.

2:
$etcprefix is a little confusing, especially when supporting non-unix OS'es in the future.
Most other modules use $config_dir instead. This also shouldn't be too hard to find/replace.

3:
There's no spec test to cover this new variable.

Keep those PR's coming! 👍

@arioch arioch mentioned this pull request Apr 26, 2016
@zachfi
Copy link
Contributor

zachfi commented Apr 26, 2016

+1 to what @arioch says.

$dirprefix = false,
$etcprefix = false,
$shareprefix = false,
$varprefix = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't want to mix types here. The usage of these variables is all strings, while the default here is boolean. I'd think that an empty string here would be more accurate.

@TheFlyingCorpse
Copy link
Contributor Author

Right, thanks for your feedback, I'll get right to adapting as the feedback here has told me to.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from 4ac27c6 to 26083ee Compare April 26, 2016 18:36
@TheFlyingCorpse
Copy link
Contributor Author

I'll merge my commits if the update looks good enough.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch 2 times, most recently from 71c49d8 to f49387f Compare April 26, 2016 19:39
@TheFlyingCorpse
Copy link
Contributor Author

I am at least missing a spec test for the variables. I'll look at that tomorrow.

@arioch
Copy link
Contributor

arioch commented Apr 28, 2016

Maybe also replicace $::icinga2::dirprefix with $::icinga2::dir_prefix to match the overall variable naming scheme.

Other than that if you add the spec test it looks good to me. 👍

@zachfi
Copy link
Contributor

zachfi commented Apr 28, 2016

And @arioch, once this is merged, I assume that we will be on the lookout for any variables that reference the path without the prefix. True story?

@arioch
Copy link
Contributor

arioch commented Apr 28, 2016

I'm guessing you mean in future PR's... if so you're absolutely right.
A quick grep through the code learned that @TheFlyingCorpse was very thorough. 👍

@zachfi
Copy link
Contributor

zachfi commented Apr 28, 2016

Yes yes, I meant future PRs.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from 109285d to 21b4129 Compare April 30, 2016 09:11
@TheFlyingCorpse
Copy link
Contributor Author

Like so. I could not resolve $dir_prefix in params. I moved the path resolving to its own class and all paths resolve correctly now with a test file. If this is not a good/accepted solution please advise how you would like it instead. If I didnt use "$dir_prefix", everything would fit in params.pp and all the used vars would be as suggested with ::icinga2::__dir / dir_prefix, instead of icinga2::paths::__dir / dir_prefix

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from 21b4129 to f431357 Compare April 30, 2016 19:28
@zachfi
Copy link
Contributor

zachfi commented May 2, 2016

The changes here look good to me. Why support both config_dir and dir_prefix? It seems like they solve the same problem, and the paths class will only use one at a time anyway.

@TheFlyingCorpse
Copy link
Contributor Author

@xaque208 - The reason was to allow for setting up for a case where you compile icinga2 to use /opt/icinga2 with the dir_prefix, making sure then that config can be in /opt/icinga2/etc rather than /opt/icinga2/etc/icinga2. It would also set "good" paths for the other variables to some small effect for simplicity. It is trivial to remove the dir_prefix, and that would remove the need of the path class.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from f431357 to c86aa54 Compare May 6, 2016 19:21
@TheFlyingCorpse
Copy link
Contributor Author

I redid it without the dir_prefix, it only contains the directories directly in params now and is the simplest I can get it. I havent been able to find a way to test for variables in spec, so I can not at the moment test for the output of sbin_dir (which will be used for Windows) and share_dir.

@zachfi
Copy link
Contributor

zachfi commented May 6, 2016

This work looks good to me. I think I'd still prefer that the use of i2* variables in the params class get moved to a separate commit, since those variables are not implemented here, though perhaps that is a nitpick. I'm +1 for this change. Thank you for the efforts @TheFlyingCorpse. We'll see what the grown-ups think.

@TheFlyingCorpse
Copy link
Contributor Author

TheFlyingCorpse commented May 6, 2016

The i2 variables will be used immediately after this commit is accepted in the Windows PR I have not submitted yet, waiting for this and the puppet_ssldir one. I'll remove them if one more says it shouldnt stay in this commit, since that can come in the Windows commit, though I saw some use in the i2* feature for one of the BSD's which is waiting on this commit to use what I assume is the config_dir parameter at least.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from c86aa54 to dce0308 Compare May 8, 2016 20:31
@TheFlyingCorpse
Copy link
Contributor Author

Like so, I think I solved it by changing out if with unless, so you can override on a per osfamily basis for the parameters you want to. If anything else, let me know!

@zachfi
Copy link
Contributor

zachfi commented May 19, 2016

I'm still +1 on the changes.

@Reamer
Copy link
Contributor

Reamer commented Jun 4, 2016

👍 (tested in my enviroment)

@TheFlyingCorpse
Copy link
Contributor Author

@arioch - Anything more I should change? I'm on vacation this week to hopefully get this PR accepted and move on with the Windows support.

@TheFlyingCorpse TheFlyingCorpse force-pushed the feature/prefix-to-paths branch from dce0308 to 8b50ff5 Compare July 23, 2016 15:02
@TheFlyingCorpse
Copy link
Contributor Author

TheFlyingCorpse commented Jul 23, 2016

Rebased on current develop!

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

Successfully merging this pull request may close these issues.

4 participants