【问题标题】:mcollective agent parameter definitionmcollective 代理参数定义
【发布时间】:2018-03-09 20:11:24
【问题描述】:

以下ddl

action 'ant', :description => "Runs ant in the application directory" do
  input :application,
      :prompt      => "Application(s)",
      :description => "Application's instance name(s)",
      :type        => :string,
      :validation  => '^[a-z0-9_,\-]+$',
      :maxlength   => 500,
      :optional    => false

可以在代理内部使用获取命令行参数application

  # entry point for the ant target
  action 'ant' do
    # find eligible applications
    applications = request[:application].split(',').select{|a| valid_application?(a) }

command命令可以以mco <agentname> -a applicationname1,applicationname2等开头。发出mco <agentname> --help 给了我:

$ mco ehyp --help
Manage an <internal> application
Application Options
    -a, --application APPLICATION    Application to manage

我在-a--applicationrequest[:application] 之间找不到“链接”。它在哪里定义了如何解释这些命令行开关?

【问题讨论】:

    标签: puppet mcollective


    【解决方案1】:

    它是在MCollective::Application 中定义的:

    option :application,
         :description => 'Application to manage',
         :arguments   => ['-a', '--application APPLICATION'],
         :required    => true
    
    option :destination,
         :description => 'Ant target ("destination") to call',
         :arguments   => ['-d', '--destination TARGET'],
         :required    => true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-06
      • 2015-09-29
      • 2020-06-05
      • 2012-06-23
      • 2020-03-01
      • 2017-02-17
      相关资源
      最近更新 更多