Host paramaters erb character

Hi,

I'm trying to let the host.params in satellite write the correct config to
a sudoers file.
At the moment i came to a point where my kickstart creates a file:

cat <<EOF > /etc/sudoers.d/extra <%= @host.params['sudoers-extra'] %> EOF

And in my host group i have a parameter which is written at deployment.
This works.

Now if i have multiple entries in my parameter field like this:

myuser ALL=(root) NOPASSWD:ALL
myuser2 ALL=(root) NOPASSWD:ALL
myuser3 ALL=(root) NOPASSWD:ALL

I want them al 3 to be written to my extra sudoers file, but then every
line ends with an ^M character.
As im not familiar with ERB i dont get how to make sure this character is
not written because it makes my sudoers file invalid.

Does someone know how i can not print the extra character?

Sounds like a problem of filling in the parameter field in Windows and
having it insert \r\n (carriage return, newline) as opposed to just
the Unix style of \n.
Maybe something like this would work for your snippet:

<%= @host.params['sudoers-extra'].delete("\r") %>

ยทยทยท On Tue, Mar 21, 2017 at 4:23 AM, Lars wrote: > Hi, > > I'm trying to let the host.params in satellite write the correct config to a > sudoers file. > At the moment i came to a point where my kickstart creates a file: > > cat < /etc/sudoers.d/extra <%= @host.params['sudoers-extra'] %> EOF > > > And in my host group i have a parameter which is written at deployment. This > works. > > Now if i have multiple entries in my parameter field like this: > > myuser ALL=(root) NOPASSWD:ALL > myuser2 ALL=(root) NOPASSWD:ALL > myuser3 ALL=(root) NOPASSWD:ALL > > I want them al 3 to be written to my extra sudoers file, but then every line > ends with an ^M character. > As im not familiar with ERB i dont get how to make sure this character is > not written because it makes my sudoers file invalid. > > Does someone know how i can not print the extra character? > > -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.