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

Needs a different way of working with VCL functions #122

Open
kwisatz opened this issue Nov 21, 2016 · 10 comments
Open

Needs a different way of working with VCL functions #122

kwisatz opened this issue Nov 21, 2016 · 10 comments

Comments

@kwisatz
Copy link
Contributor

kwisatz commented Nov 21, 2016

The current way of completely replacing VCL functions is not very practical since it also removes essential parts such as for instance the inclusion of backend selectors, etc.

I don't currently have a concrete idea of what it should look like, any ideas welcome!

@slavaaaaaaaaaa
Copy link

For now it would help having prepends/appends on all functions, not just select few.

For example, vcl_deliver only has the option to replace the entire function, without a prepend option, while vcl_rcv has both.

If you'd like, I'll PR the change, but would prefer not going through the hassle if it's not going to get merged anyway. Let me know what you think!

Cheers!

@func0der
Copy link

func0der commented Sep 4, 2017

@smaslennikov Just PR it ;) Someone will use it. And as you see, there is a need for it.

Maintainers need the help of the community. As you see, there are many open issues, but not PRs at all.
And even though the maintainer should probably be more active in this project, the contributers should be, too :)

@EmersonPrado
Copy link

Is this what you're looking for?

@EmersonPrado
Copy link

I also thought about functions which created some code blocks from hashes. This would probably make it quite easier on the user. Pls check this idea out.
Unfortunately, I only have a test environment for Puppet 3, so this example uses the legacy Ruby API.

@EmersonPrado
Copy link

EmersonPrado commented Oct 2, 2017

Hi @kwisatz and @smaslennikov ! I am working on some ideas, and would like to know your opinion on them, plus @maxchk 's. I thought about some helper functions which could be used in the templates, which would turn simple arrays and/or hashes into full blocks of code. Something like:

$pass_urls => ['/some', '/other', '/whatever']

Ends up in:

if (req.url == "/some" ||
  req.url == "/other" ||
  req.url == "/whatever") {
    return (pass);
}

The function should be flexible enough to test different request parameters (besides req.url) and actions (besides return(pass)) and accept regular expressions - making the test like req.something ~ "regex".

Does this sound good?

@slavaaaaaaaaaa
Copy link

Folks,

Since commenting on this, I've changed jobs and haven't used the word Puppet (except in vain) in months. I'm glad this module is resuming strong development, but unfortunately, I don't think I can be of my help here.

Cheers!

maxchk added a commit that referenced this issue Oct 3, 2017
[Issue #122] Add prepend and append sections for sub vcl_deliver
@EmersonPrado
Copy link

Since we got quite a traction, I added the same stuff for the sub vcl_backend_response in PR 162. I guess we don't need this in other sections, since they have too little code to replace. But, if the people find it a good idea, I can PR the same thing in all other subs too. Just let me know.

@EmersonPrado
Copy link

I gave up on the idea of ruby functions to create if blocks. There are so many different situations that either the function would be too complex or to little useful. Or we'd end up with tons of functions trying to cover it all. It would confuse the user more than help. So I'll be happy with whatever we get from the prepend/append functions.

maxchk added a commit that referenced this issue Jan 3, 2018
[Issue #122] Add prepend and append sections for sub vcl_backend_response
@luyseyal
Copy link
Contributor

luyseyal commented Jan 3, 2018

@EmersonPrado Does the merged PR close this issue?

@EmersonPrado
Copy link

@luyseyal I'd think so. At least, it's all I can think of about. I'd like to hear from the OP, but I don't know if he's following.

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

No branches or pull requests

5 participants