没有正确构建的Puppet哈希数组

时间:2014-11-13 23:44:26

标签: puppet

您好我正在尝试使用以下代码构建哈希数组:

$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'],
    ],
  }

你看到哪些目录我试图使用$ stdDirectoryValue的变量,然后在index_ignore哈希后添加。 我在conf文件中最终得到的是:

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

如何让它在我的文件中包含index_ignore哈希?

1 个答案:

答案 0 :(得分:1)

我认为你不想要哈希数组 - 你需要哈希合并。

尝试puppetlabs-stdlib模块中的merge function

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