为什么木偶烧杯无法解决角色"代理",而主/数据库/仪表板工作正常?

时间:2014-10-29 08:35:42

标签: puppet

我的节点集定义如下..

---------- Some of the attributes removed for clarity ----------------------
HOSTS:
  kpointvm1.zencite.com:
    roles:
      - master
    hypervisor : vagrant
  kpointvm2.zencite.com:
    roles:
      - agent
    hypervisor : vagrant
----------------------

当我运行测试时,它失败并跟随堆栈跟踪

----------------------
/opt/manish/kpoint_beaker/spec/spec_helper_acceptance.rb:28:in `<top (required)>': undefined local variable or method `agent' for main:Object (NameError)
        from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /opt/manish/kpoint_beaker/spec/acceptance/001_basic_spec.rb:1:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/configuration.rb:1105:in `load'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/configuration.rb:1105:in `block in load_spec_files'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/configuration.rb:1105:in `each'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/configuration.rb:1105:in `load_spec_files'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/runner.rb:96:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/runner.rb:84:in `run'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib/rspec/core/runner.rb:37:in `invoke'
        from /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/exe/rspec:4:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p545/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-support-3.1.0/lib:/usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/lib /usr/local/rvm/gems/ruby-1.9.3-p545/gems/rspec-core-3.1.4/exe/rspec spec/acceptance --color failed
----------------------

以下是“开启”电话......

on agent, "mkdir -p /tmp/I-am-the-agent"

令人惊讶的是,如果我将角色更改为主/仪表板/数据库,则无需运行 任何问题。

我认为“代理人”可能是一个保留字,虽然文档使用它, 我尝试过其他角色,但也失败了。

My environment is
----------------------
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux] (Running in RVM)
beaker (1.19.1)
----------------------

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

根据Josh on puppet-user google group,似乎我应该使用代理而不是代理。

可能有多个代理商,因此可能有代理商。

wiki有一个例子,其中包含“on agents”的正确示例。 但是,一些DSL呼叫指的是代理,我被其中一个呼叫绊倒了。

更新

经过一些试验和错误后,我也可以使用自定义角色。诀窍是在“on”调用中引用自定义角色作为符号,例如, “on:customerole'做点什么'”。 看看代码,Beaker应该为这些自定义角色定义方法,但不知何故它没有这样做。