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

Add support for setting UserDir in Virual Hosts #2192

Merged
merged 1 commit into from
May 23, 2022

Conversation

smortex
Copy link
Collaborator

@smortex smortex commented Sep 12, 2021

We can only set this setting at the VirtualHost level by relying on the
custom_fragment parameter, which does not scale when we want to enable
UserDir for a single VHost because we have to manually disable it on all
other VHosts.

With this change, one can ensure UserDir is active only on specific
VHost with something like:

Apache::Vhost {
  userdir => 'disabled',
}

apache::vhost { 'example.com':
  # [...]
  userdir => 'enabled',
}

A specific userdir parameter avoid clashes that would prevent this
technique to be effective with custom_fragment.

@smortex smortex requested a review from a team as a code owner September 12, 2021 05:07
@puppet-community-rangefinder
Copy link

apache::vhost is a type

that may have no external impact to Forge modules.

This module is declared in 173 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

We can only set this setting at the VirtualHost level by relying on the
`custom_fragment` parameter, which does not scale when we want to enable
UserDir for a single VHost because we have to manually disable it on all
other VHosts.

With this change, one can ensure UserDir is active only on specific
VHost with something like:

```
Apache::Vhost {
  userdir => 'disabled',
}

apache::vhost { 'example.com':
  # [...]
  userdir => 'enabled',
}
```

A specific `userdir` parameter avoid clashes that would prevent this
technique to be effective with `custom_fragment`.
@smortex
Copy link
Collaborator Author

smortex commented Sep 12, 2021

Hum, just realized that apache::mod::userdir has a custom_fragment parameter, allowing:

class { 'apache::mod::userdir':
  custom_fragment => @(CONFIG),
      UserDir disabled
    | CONFIG
}

apache::vhost { 'example.com':
  # [...]
custom_fragment => @(CONFIG),
      UserDir enabled
    | CONFIG
}

I think this change allow a more readable configuration (as described above) so maybe this change still make sense?

@sheenaajay
Copy link
Contributor

Thanks @smortex for submitting the PR. Ohh you are right. We can use apache::mod::userdir for specifying UserDir.
Just wondering that will lead two ways to use the same parameter. When it comes to maintenance we need to modify it in multiple places.

@github-actions
Copy link

github-actions bot commented May 9, 2022

This PR has been marked as stale because it has been open for a while and has had no recent activity. If this PR is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.

@david22swan
Copy link
Member

@smortex Hey sorry for the wait on a review on this.
Anyway was wondering if it was still something that you wished to have merged, considering the discussion between you and Sheena above?
If it is then could you please update the documentation to reflect the change and we can see about getting it merged in.

@smortex
Copy link
Collaborator Author

smortex commented May 18, 2022

@david22swan Yeah, I see this PR from time to time and have mixed feelings about it: relying on custom_fragments indeed works but is quite hackish and I do not like it much (I trend to consider custom_fragments as a good way to use new features in apache that have not been integrated in the module while waiting for them to be added). This PR allows a more readable implementation in end-users control repo but at the cost of quite a lot of code in the module in regard of the added value 🤷.

If you think it is a waste of time, feel free to close this PR, otherwise I will be a happy user of this feature one it is merged 😉

@david22swan
Copy link
Member

@smortex Talked it over and we're good with this change so gonna go ahead and merge.
Thank's for putting in the work :)

@david22swan david22swan merged commit 326c1ec into puppetlabs:main May 23, 2022
@smortex smortex deleted the vhost-userdir branch May 25, 2022 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants