On 2018-08-16 15:51, Helmut Schneider wrote:
Henrik Lindberg wrote:

If your data looks like this:

variables:
    baculaWorkingDirectory: '/var/lib/bacula'

Then you do not have a variables.debug key - you can lookup
variables, or variables.baculaWorkingDirectory

common.yaml:

---
netconfig:
variables:
   debug:               0
   baculaConfPath:         '/etc/bacula'
   baculaClientService:    'bacula-fd'
   baculaDirectorService:  'bacula-dir'
   baculaStorageService:   'bacula-sd'
   baculaClientPackage:    'bacula-client'
   baculaServerPackage:    'bacula-server'
   baculaWorkingDirectory: '/var/lib/bacula'
   baculaGID:              'bacula'
   baculaUID:              'bacula'
   apachePackage:       'httpd'
   apacheService:       'httpd'
   fail2banConfPath:    '/etc/fail2ban'
   fail2banPackage:     'fail2ban'
   fail2banService:     'fail2ban'
   logrotatePackage:    'logrotate'
   openvpnPackage:      'openvpn'
   openvpnService:      'openvpn'
   openvpnConfPath:     '/etc/openvpn'
   perlDbiPackage:      'libdbi-perl'
   perlDbdMysqlPackage: 'libdbd-mysql-perl'
   puppetService:       'puppet'
   rootUID:             'root'
   rootGID:             'root'
   rsyslogPackage:      'rsyslog'
   rsyslogService:      'rsyslog'
   snmpdConfPath:       '/etc/snmp'
   snmpdService:        'snmpd'
   spamassassinPackage: 'spamassassin'
   syslogUID:           'root'
   syslogGID:           'root'
   ufwConfPath:         '/etc/ufw'
   ufwPackage:          'ufw'
   ufwService:          'ufw'

I meanwhile found out that

lookup('variables.baculaWorkingDirectory', String, 'deep')

works while

lookup('variables.baculaWorkingDirectory')

does not. The problem is that in apps/bacula.yaml

WorkingDirectory: "%{lookup('variables.baculaWorkingDirectory')}"

works (but gives an emtpy string as 'variables.baculaWorkingDirectory'
is not found) while

WorkingDirectory: "%{lookup('variables.baculaWorkingDirectory', String,
'deep')}"

does not:

Error: Could not retrieve catalog from remote server: Error 500 on
SERVER: Server Error: Evaluation Error: Error while evaluating a
Function Call, Lookup of key 'profiles' failed: Syntax error in string:
%{lookup('variables.baculaWorkingDirectory', String, 'deep')} at
/etc/puppetlabs/code/modules/config/manifests/init.pp:43:15 on node
h2786452

apps/bacula.yaml:

---
profiles:
   backup:
     bacula:
       defaults:
[...]
         Client:
           FileDaemon:
             "%{::fqdn}-fd":
               FDport:                    9102
               #WorkingDirectory:
"%{lookup('variables.baculaWorkingDirectory')}"
               WorkingDirectory:
"%{lookup('variables.baculaWorkingDirectory', String, 'deep')}"
[...]


You cannot give arguments to lookup as an interpolation function inside of data. Use the commented out variant. Then use lookup_options (in your data) to configure that lookup of 'variables' should always be a 'deep' merge.

- henrik

--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/pl40fc%241bb%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to