简体   繁体   English

人偶依赖

[英]Puppet dependency

I'm misunderstanding something about puppet, but I'm having trouble formulating it well enough to succeed at searching for it. 我对木偶有一些误解,但我在制定它的方法方面遇到了麻烦,无法成功进行搜索。

I have some hosts that run rails. 我有一些运行rails的主机。 So I have a puppet module that sets up such hosts. 因此,我有一个设置此类主机的人偶模块。

class rails_server {
  ...
}

And I have some hosts that know how to deploy to rails servers, do tests on rails services, etc. 我有一些主机,他们知道如何部署到Rails服务器,在Rails服务上进行测试等。

class rails_deployment {
  ...
}

And both of them depend on having certain gems installed, a certain ruby version,etc. 而且它们都依赖于安装了某些宝石,某种红宝石版本等。

class rails_dependencies {
  class { '::rvm': }
  rvm_system_ruby { ... }
  rvm_gem { ... }
}

But this seems a bit of kludge, because in my site.pp , I have to state explicitly that I want rails_dependencies installed. 但这似乎有点site.pp ,因为在我的site.pp ,我必须明确声明要安装rails_dependencies But if instead I have rails_server and rails_deployment both include rails_dependencies , and then try to bring up a test host that can run the server and test and deploy to itself, I get a duplicate declaration error. 但是,如果我有rails_serverrails_deployment都包含rails_dependencies ,然后尝试启动一个可以运行服务器并测试并部署到自身的测试主机,则会收到重复的声明错误。

It's hard to answer the question without more example code. 没有更多示例代码,很难回答这个问题。 Using include will prevent duplicate declarations of the same class, so it's probably somewhere else? 使用include将防止相同类的重复声明,所以它可能在其他地方吗?

Pasting the error and the lines of code it refers to would be helpful 粘贴错误及其所引用的代码行将很有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM