首页 \ 问答 \ Salt-Stack需要声明(Salt-Stack require statement)

Salt-Stack需要声明(Salt-Stack require statement)

我开始玩Salt了。 我找不到任何关于如何使状态依赖于多个其他状态的信息。

state_a:
  module.run:
    - name: my.module
    - m_name: name_a

state_b:
  module.run:
    - name: my.module
    - m_name: name_b

state_c:
  module.run:
    - name: my.module
    - m_name: name_c

    - require:
      - module: ...

我怎样才能让state_c同时require state_astate_b

额外问题 :使用Key: Single Value结构在Salt中定义依赖关系的原因是什么?


I've started playing with Salt. I could not find any info on how to make a state depend on multiple other states.

state_a:
  module.run:
    - name: my.module
    - m_name: name_a

state_b:
  module.run:
    - name: my.module
    - m_name: name_b

state_c:
  module.run:
    - name: my.module
    - m_name: name_c

    - require:
      - module: ...

How can I make state_c to require both state_a and state_b?

Bonus question: What is the rationale behind using Key: Single Value structure for defining dependencies in Salt?


原文:https://stackoverflow.com/questions/30842588
更新时间:2024-03-20 13:03

最满意答案

您是否尝试过直接在您的关联中定义订单? 我从来没有需要这样做,所以我不能发誓它会做你以后的事情,但是:

class City extends AppModel {
    $belongsTo = array(
        'Country' => array(
            'Order' => 'Country.name'
        )
    );
} 

当然,你可以为你的Country模式做类似的事情。


Have you tried defining the order directly in your association? I've never needed to do this, so I can't swear it will do what you're after, but:

class City extends AppModel {
    $belongsTo = array(
        'Country' => array(
            'Order' => 'Country.name'
        )
    );
} 

You could do something similar for your Country model, of course.

相关问答

更多
  • 蛋糕的神奇作品......有条件...... 你认为可能是正确的,因为模型关系设置正确,它应该......工作。 但是您缺少一部分:将列表传递给视图。 那部分并不神奇。 阅读这部分文档 (在inputs开始之前几乎一直向下) 如果要在使用belongsTo - 或hasOne - Relation时创建选择字段,可以添加以下[...] (现在把你应该放的东西......) $this->set('staffs', $this->Pending->Staff->find('list')); 备注:注意变量名 ...
  • 我在CakePHP文档中找到了一个simliar问题的解决方案: http://book.cakephp.org/2.0/en/models/virtual-fields.html#virtual-fields-and-model-aliases 所以基本上,只要你想使用模型别名,最好在构造函数中定义这样的值: public function __construct($id = false, $table = null, $ds = null) { parent::__construct($ ...
  • 这个怎么样? class UserRelationship { var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id' ), 'Friend' => array( 'className' => 'User', 'foreignKey' ...
  • 如果你想随时随地使用,就像这样使用 对于cakephp 3.x $this->Virtualwarehouse->belongsTo('User',[ 'foreignKey' => 'winner', 'joinType' => 'INNER' ]); $winners = $this->Virtualwarehouse->find('all', [ 'contain'=>['User'] ]); $this-> ...
  • 您是否尝试过直接在您的关联中定义订单? 我从来没有需要这样做,所以我不能发誓它会做你以后的事情,但是: class City extends AppModel { $belongsTo = array( 'Country' => array( 'Order' => 'Country.name' ) ); } 当然,你可以为你的Country模式做类似的事情。 Have you tried defining the order dir ...
  • 与此同时,我可以让它发挥作用。 它真的只有几个字符..我复制结果,也许有人可以在以后使用它。 模型: public $filterArgs = array( 'username' => array('type' => 'like', 'field' => 'User.name'), 'status' => array('type' => 'like'), ... ); 视图: echo $this->Form->input('username', array('type' => 'text', ...
  • 我设法解决了这个问题。 简而言之,模型模型链接不是单向的,因为CakePHP文档称之为。 例如,如果模型A belongsTo模型B,则模型B必须hasOne或具有多个模型A. 就我而言,接收端的语法错误。 I managed to fix this issue. Simply put, model-model links are not a one-way street as the CakePHP documentation calls it. For example if model A belong ...
  • 尝试这个 var $belongsTo = array('Client','Doctor'); 它被称为数组。 更多关于文档中的数组 try this var $belongsTo = array('Client','Doctor'); it's called array. more about arrays in documentation
  • 实际上我认为这是幻灯片和资产之间的一对多关系。 从Model association页面 : belongsTo:当前模型包含外键。 因此,任何具有另一个外键的模型都属于另一个。 所以我看待它的方式: 项目: hasMany幻灯片 滑动: belongsTo Item(with item_id) belongsTo Asset(with asset_id) 资产: hasMany幻灯片 为了检索您想要的关联模型,我建议查看Containable行为 。 Actually I think this is a ...
  • 如果您设置表格以正确反映它们之间的关系,CakePHP确实可以让您的生活更轻松。 您可以将代码减少90%,因为您不必尝试手动指定表的链接方式。 students --------------------------------------------- id | firstname | lastname | email graduate_applicants ------------------------------------ id | student_id | ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)