Hi,
I am working on fixing an issue [1] where backslashes in configuration template names are used in routes, causing issues like 404's. I've submitted a pull request [2] that fixes the problem, but it parameterizes the template names which can cause problems when loading snippets because the template name will have changed. Another potential solution is switch to using the ID in the route instead the name, but that will cause API users to alter how they consume config templates.
So…what do you all think?
-Sam
- Bug #1827: Template names to / (i.e. w/) cause issues with routes based on ID - Foreman
- https://github.com/theforeman/foreman/pull/355
Backslashes or forwardslashes? (You said backslashes, which I don't think
we should necessarily support, but the stack track in the ticket had a
forwardslash in the template name.)
Wondering if the answer to the big picture issue of Template names, is just
to URL encode them. e.g. / = %2F%0A
-Brian
P.S. - Karma?
···
On Tue, Jan 15, 2013 at 10:38 PM, Sam Kottler wrote:
Hi,
I am working on fixing an issue [1] where backslashes in configuration
template names are used in routes, causing issues like 404’s. I’ve
submitted a pull request [2] that fixes the problem, but it parameterizes
the template names which can cause problems when loading snippets because
the template name will have changed. Another potential solution is switch
to using the ID in the route instead the name, but that will cause API
users to alter how they consume config templates.
So…what do you all think?
-Sam
- Bug #1827: Template names to / (i.e. w/) cause issues with routes based on ID - Foreman
- https://github.com/theforeman/foreman/pull/355
–
http://aws.amazon.com/solutions/solution-providers/brandorr/
Sorry, meant forward slashes. I always mix up the two 
-Sam
···
----- Original Message -----
From: "Brian Gupta"
To: foreman-dev@googlegroups.com
Sent: Tuesday, January 15, 2013 11:58:44 PM
Subject: Re: [foreman-dev] Config templates: using parameterized routes vs. ID's
Backslashes or forwardslashes? (You said backslashes, which I don’t think we should necessarily support, but the stack track in the ticket had a forwardslash in the template name.)
Wondering if the answer to the big picture issue of Template names, is just to URL encode them. e.g. / = %2F%0A
-Brian
P.S. - Karma?
On Tue, Jan 15, 2013 at 10:38 PM, Sam Kottler < skottler@redhat.com > wrote:
Hi,
I am working on fixing an issue [1] where backslashes in configuration template names are used in routes, causing issues like 404’s. I’ve submitted a pull request [2] that fixes the problem, but it parameterizes the template names which can cause problems when loading snippets because the template name will have changed. Another potential solution is switch to using the ID in the route instead the name, but that will cause API users to alter how they consume config templates.
So…what do you all think?
-Sam
- Bug #1827: Template names to / (i.e. w/) cause issues with routes based on ID - Foreman
- https://github.com/theforeman/foreman/pull/355
–
Mmmm. Do we have a standard for Template naming? If not I think we should
set one, and enforce it. (The minimal standard should be printable chars,
however, I think we may want to be more restrictive than that and do input
validation.)
Thanks,
-Brian
P.S. - Sorry for making this potentially a bigger conversation than you
planned.
···
On Wed, Jan 16, 2013 at 12:33 AM, Sam Kottler wrote:
Sorry, meant forward slashes. I always mix up the two 
-Sam
----- Original Message -----
From: “Brian Gupta” brian.gupta@brandorr.com
To: foreman-dev@googlegroups.com
Sent: Tuesday, January 15, 2013 11:58:44 PM
Subject: Re: [foreman-dev] Config templates: using parameterized routes
vs. ID’s
Backslashes or forwardslashes? (You said backslashes, which I don’t think
we should necessarily support, but the stack track in the ticket had a
forwardslash in the template name.)
Wondering if the answer to the big picture issue of Template names, is
just to URL encode them. e.g. / = %2F%0A
-Brian
P.S. - Karma?
On Tue, Jan 15, 2013 at 10:38 PM, Sam Kottler < skottler@redhat.com > > wrote:
Hi,
I am working on fixing an issue [1] where backslashes in configuration
template names are used in routes, causing issues like 404’s. I’ve
submitted a pull request [2] that fixes the problem, but it parameterizes
the template names which can cause problems when loading snippets because
the template name will have changed. Another potential solution is switch
to using the ID in the route instead the name, but that will cause API
users to alter how they consume config templates.
So…what do you all think?
-Sam
- Bug #1827: Template names to / (i.e. w/) cause issues with routes based on ID - Foreman
- https://github.com/theforeman/foreman/pull/355
–
–
http://aws.amazon.com/solutions/solution-providers/brandorr/
I think you are right - it makes no sense to change special chars without
the user knowing about them, its better to prevent the user inputing them
in the first place.
saying that, if we do want to allow chars such as '/' we should not use the
names in the uri and fallback to record ID instead.
I would vote +1 to change it back to ID on the UI controllers, if we want,
we could append the name after the ID using the to_param and parameterize
methods in rails.
for the API, we could leave it as is for V1 and fix it in V2 of the API,
afair, the v1 already accepts both name and ID so maybe its not a big deal
for a user to switch from one to the other?
Ohad
···
On Wed, Jan 16, 2013 at 7:40 AM, Brian Gupta wrote:
Mmmm. Do we have a standard for Template naming? If not I think we should
set one, and enforce it. (The minimal standard should be printable chars,
however, I think we may want to be more restrictive than that and do input
validation.)
> afair, the v1 already accepts both name and ID so maybe its not a big deal for a user to switch from one to the other?
Yes, this correct, both name and ID.
···
----- Original Message -----
From: "Ohad Levy"
To: "foreman-dev"
Sent: Wednesday, January 16, 2013 9:26:30 AM
Subject: Re: [foreman-dev] Config templates: using parameterized routes vs. ID's
On Wed, Jan 16, 2013 at 7:40 AM, Brian Gupta < brian.gupta@brandorr.com > wrote:
Mmmm. Do we have a standard for Template naming? If not I think we should set one, and enforce it. (The minimal standard should be printable chars, however, I think we may want to be more restrictive than that and do input validation.)
I think you are right - it makes no sense to change special chars without the user knowing about them, its better to prevent the user inputing them in the first place.
saying that, if we do want to allow chars such as ‘/’ we should not use the names in the uri and fallback to record ID instead.
I would vote +1 to change it back to ID on the UI controllers, if we want, we could append the name after the ID using the to_param and parameterize methods in rails.
for the API, we could leave it as is for V1 and fix it in V2 of the API, afair, the v1 already accepts both name and ID so maybe its not a big deal for a user to switch from one to the other?
Ohad