Movatterモバイル変換


[0]ホーム

URL:


CFEngine documentation homepage

lib/feature.cf

Suggest changes
Table of contents

classes bodies

feature_cancel

Prototype:feature_cancel(x)

Description: Undefine classx when promise is kept or repaired

Used internally by bundlefeature

Arguments:

  • x

Implementation:

code
bodyclassesfeature_cancel(x){cancel_kept=>{"$(x)"};cancel_repaired=>{"$(x)"};}

agent bundles

feature

Prototype:feature

Description: Finds feature_set_X and feature_unset_X classes and sets/unsets X persistently

Finds all classes namedfeature_unset_X and clear class X.

Finds all classes namedfeature_set_DURATION_X and sets class Xpersistently for DURATION. DURATION can be any digits followed byk,m, org.

In inform mode (-I) it will report what it does.

Example:Set classxyz for 10 minutes, classqpr for 100 minutes, andijk for 90m minutes. Unset classabc.cf-agent -I -f ./feature.cf -b feature -Dfeature_set_10_xyz,feature_set_100_qpr,feature_set_90m_ijk,feature_unset_abc

Implementation:

code
bundleagentfeature{classes:"parsed_$(on)"expression=>regextract("feature_set_([0-9]+[kmgKMG]?)_(.*)",$(on),"extract_$(on)");"parsed_$(off)"expression=>regextract("feature_unset_(.*)",$(off),"extract_$(off)");"$(extract_$(on)[2])"expression=>"parsed_$(on)",persistence=>"$(extract_$(on)[1])";vars:"on"slist=>classesmatching("feature_set_.*");"off"slist=>classesmatching("feature_unset_.*");"_$(off)"string=>"off",classes=>feature_cancel("$(extract_$(off)[1])");reports:"DEBUG|DEBUG_$(this.bundle)"::"DEBUG$(this.bundle):$(on) => SET class '$(extract_$(on)[2]) for '$(extract_$(on)[1])'"if=>"parsed_$(on)";"DEBUG$(this.bundle):$(off) => UNSET class '$(extract_$(off)[1])'"if=>"parsed_$(off)";"DEBUG$(this.bundle): have$(extract_$(on)[2])"if=>"$(extract_$(on)[2])";"DEBUG$(this.bundle): have no$(extract_$(on)[2])"if=>"!$(extract_$(on)[2])";"DEBUG$(this.bundle): have$(extract_$(off)[1])"if=>"$(extract_$(off)[1])";"DEBUG$(this.bundle): have no$(extract_$(off)[1])"if=>"!$(extract_$(off)[1])";}

feature_test

Prototype:feature_test

Description: Finds feature_set_X and feature_unset_X classes and reports X

Note that this bundle is intended to be used exactly likefeatureand just show what's defined or undefined.

Example:Check classesxyz,qpr,ijk, andabc.cf-agent -I -f ./feature.cf -b feature_test -Dfeature_set_10_xyz,feature_set_100_qpr,feature_set_90m_ijk,feature_unset_abc

Implementation:

code
bundleagentfeature_test{classes:"parsed_$(on)"expression=>regextract("feature_set_([0-9]+[kmgKMG]?)_(.*)",$(on),"extract_$(on)");"parsed_$(off)"expression=>regextract("feature_unset_(.*)",$(off),"extract_$(off)");vars:"on"slist=>classesmatching("feature_set_.*");"off"slist=>classesmatching("feature_unset_.*");reports:"$(this.bundle): have$(extract_$(on)[2])"if=>"$(extract_$(on)[2])";"$(this.bundle): have no$(extract_$(on)[2])"if=>"!$(extract_$(on)[2])";"$(this.bundle): have$(extract_$(off)[1])"if=>"$(extract_$(off)[1])";"$(this.bundle): have no$(extract_$(off)[1])"if=>"!$(extract_$(off)[1])";}

Still need help?

Chat Ask a question on Github Mailing list
Version 
master3.24 (LTS)3.21 (LTS)view all versions

[8]ページ先頭

©2009-2025 Movatter.jp