epp adding equals sign to file [closed]

asked 2017-10-16 15:09:15 -0600

cohdjn gravatar image

updated 2017-10-19 14:35:47 -0600

Here's a snip of my template...

#!/bin/bash
# This file is managed by Puppet.

<% if $cisecurity::redhat7::security::remediate_home_directories_exist == 'enabled' {-%>
# Control 6.2.7 - Ensure all users' home directories exist
cat /etc/passwd | awk -F: '{print $1 " " $3 " " $6}' | while read user uid dir; do
    if [ $uid -ge 1000 -a ! -d "$dir" -a $user != "nfsnobody" ]; then
        mkdir $dir
        chmod <%= $cisecurity::redhat7::security::home_directories_perm %> $dir
        cp /etc/skel/.* $dir

When I run the class that pumps out the epp file, the resulting file looks like this:

#!/bin/bash
# This file is managed by Puppet.

# Control 6.2.7 - Ensure all users' home directories exist
cat /etc/passwd | awk -F: '{print $1 " " $3 " " $6}' | while read user uid dir; do
    if [ $uid -ge 1000 -a ! -d "$dir" -a $user != "nfsnobody" ]; then
        mkdir $dir
        chmod = '0750' $dir
        cp /etc/skel/.* $dir

I can't figure out how or why the second-to-last line gets that equals sign in there. Any ideas would be greatly appreciated!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by cohdjn
close date 2017-10-19 14:33:55.040577

Comments

1

Because the value of `$cisecurity::redhat7::security::home_directories_perm` is `"= '0750'"`? Also, just as an advise, though EmeddedPupPet templates can access class variables, I usually parameterize my `*.epp` templates, in order to achieve maximum re-usability as possible.

Kai Burghardt gravatar imageKai Burghardt ( 2017-10-17 14:23:12 -0600 )edit

Wow! I can't believe I missed that!! :) Thank you!

cohdjn gravatar imagecohdjn ( 2017-10-18 09:24:20 -0600 )edit