Puppet语法错误

时间:2015-01-27 20:43:38

标签: vagrant puppet

尝试Error: Could not parse for environment production: Syntax error at 'conf'; expected '}' at haproxy/manifests/init.pp:4以下puppet parser validate

时收到以下错误init.pp

我已经浏览了我的班级,似乎所有的逗号和冒号都是有序的,所以我不赞成扔掉它的是什么。至于我的Vagrantfile

class haproxy {

  class { 'haproxy::install':
    $conf = '/etc/sysconfig/network'
    $seed = '11.111.111'              ## IP Seed
    $interfaces = {                   ## Generate IPConfigs based on Generic IP Variable
      'eth0'   => "${seed}.140",
      'eth0:0' => "${seed}.141",
      'eth0:1' => "${seed}.142",
    }

    ini_setting { 'networking':
      ensure  => present,
      section => '',
      setting => 'NETWORKING',
      value   => 'yes',
      path    => $conf,
    } ->

    ini_setting { 'hostname':
      ensure  => present,
      section => '',
      setting => 'HOSTNAME',
      value   => $::fqdn,
      path    => $conf,
    } ->

    ini_setting { 'gateway':
      ensure  => present,
      section => '',
      setting => 'GATEWAY',
      value   => "${seed}.1",
      path    => $conf,
    } ->

    ## Clone to ifcfg-eth0:0 and ifcfg-eth0:1
    file { '/etc/sysconfig/network-scripts/ifcfg-eth0':
      ensure => present,
      source => '/etc/sysconfig/network-scripts/ifcfg-eth0:{0,1}',
    }

    ## Puppet Lambda's
    ## REF: http://goo.gl/qFj611
    ## TRY:
    ## REQ: the puppet apply --parser=future flag
    each($interfaces) |$device, $ipaddress| {
      file { 'interfaces':
        ensure  => link,
        target  => "/etc/sysconfig/network-scripts/ifcfg-${device}",
        content => template('interfaces.erb'),
      }
    }
  }
}

Vagrantfile如果有人关心

    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    Vagrant.configure(2) do |config|
      config.vm.box       = 'Oracle-6.6_Puppet-slave'
      config.vm.box_url   = 'boxes/Oracle-6.6_Puppet-slave.box'

      config.vm.provision :puppet do |puppet|
        puppet.options        = '--parser future'                                ## Future parser required for iteration
        puppet.options        = '--hiera_config /vagrant/generic/hiera.yaml'     ## Silence...

        puppet.manifests_path = 'manifests'
        puppet.manifest_file  = 'default.pp'
        puppet.module_path    = 'modules'
      end
    end

1 个答案:

答案 0 :(得分:2)

以下是修复,从

更改
class haproxy {

  class { 'haproxy::install':
    $conf = '/etc/sysconfig/network'
    $seed = '11.111.111'              ## IP Seed
    $interfaces = {                   ## Generate IPConfigs based on Generic IP Variable
      'eth0'   => "${seed}.140",
      'eth0:0' => "${seed}.141",
      'eth0:1' => "${seed}.142",
    }

class haproxy::install {

    $conf = '/etc/sysconfig/network'
    $seed = '11.111.111'              ## IP Seed
    $interfaces = {                   ## Generate IPConfigs based on Generic IP Variable
      'eth0'   => "${seed}.140",
      'eth0:0' => "${seed}.141",
      'eth0:1' => "${seed}.142",
    }