加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 如何确保木偶类的运行顺序?

发布时间:2020-12-17 03:47:24 所属栏目:百科 来源:网络整理
导读:我是傀儡部署的新手.我定义了两个类 class taskname{ exec{ "deploy_script": command = "cp ${old_path} ${new path}",user = root,} cron{"cron_script2": command = "pyrhton ${new_path}",require = Exec["deploy_script"] } }class taksname2{ exec{ "d
我是傀儡部署的新手.我定义了两个类

class taskname{
      exec{ "deploy_script":
         command = "cp ${old_path} ${new path}",user = root,}

      cron{"cron_script2":
         command = "pyrhton ${new_path}",require = Exec["deploy_script"]
       }

 }

class taksname2{

      exec{ "deploy_script2":
         command = "cp ${old_path} ${new path}",}

      cron{"cron_script":
         command = "pyrhton ${new_path}",require = Exec["deploy_script2"]
       }



}

如何确保这两个类的运行顺序.
我试过一个新的清单文件

init.pp包含这两个类

include taskname
include taskname2

似乎第二个任务在第一个任务之前运行.如何执行正在运行的订单?

解决方法

Use one of these metaparameters.

So to sum up: whenever a resource depends on another resource,use the
before or require metaparameter or chain the resources with ->.
Whenever a resource needs to refresh when another resource changes,
use the notify or subscribe metaparameter or chain the resources with
~>. Some resources will autorequire other resources if they see them,
which can save you some effort.

Also works for classes declared with a resource-like syntax.

When declared with the resource-like syntax,a class may use any
metaparameter. In such cases,every resource contained in the class
will also have that metaparameter. So if you declare a class with noop
=> true
,every resource in the class will also have noop => true,unless they specifically override it. Metaparameters which can take more than one value (like the relationship metaparameters) will merge the values from the container and any specific values from the individual resource.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读