Caolan
Caolan

Reputation: 148

Puppet array of hashes not being built properly

Hello I am trying to build an array of hashes with the following code:

$stdDirectoryValue = {
        path          => '/',
        options       => ['Indexes','FollowSymLinks',],
        index_options => ['FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'SuppressDescription', 'SuppressSize'],
        allow_override => ['None'],
        order => 'Allow,Deny',
        allow => 'from all'
  }

  # Setting up of the website virtual hosts...
  apache::vhost { 'eds_tracker_test.eng.qpass.net':
    servername => 'eds_tracker_test.eng.qpass.net',
    port        => '80',
    serveraliases => ['eds_tracker_test'],
    docroot     => '/var/www/webapps/eds_tracker',
    error_log_file => 'logs/eds-tracker-error_log',
    directories => [
        $stdDirectoryValue,
        index_ignore =>  ['faq', 'phpmyfaq-2.6.17'],
    ],
  }

Where directories is you see I am trying to use the variable of $stdDirectoryValue, and then add on the index_ignore hash afterwards. What I end up with in my conf file is this:

<Directory "/">
  Options Indexes FollowSymLinks
  IndexOptions FancyIndexing FoldersFirst NameWidth=* SuppressDescription SuppressSize
  AllowOverride None
  Order Allow,Deny
  Allow from all
</Directory>

How do I get it to include the index_ignore hash in my file?

Upvotes: 0

Views: 347

Answers (1)

Felix Frank
Felix Frank

Reputation: 8223

I don't think you want an array of hashes here - you need a hash merge.

Try the merge function from the puppetlabs-stdlib module.

directories => [
    merge($stdDirectoryValue, { index_ignore =>  ['faq', 'phpmyfaq-2.6.17'] }),
],

Upvotes: 1

Related Questions