forked from Normation/rudder
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gpoblon
committed
Mar 2, 2020
1 parent
b7a7c9a
commit 6fd6db0
Showing
32 changed files
with
617 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@format=0 | ||
|
||
enm error { | ||
true, | ||
false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
global enum os { | ||
debin # 1 ast::enum_mapping() | ||
} | ||
|
||
enum osa ~> family { # 1 ast::add_enum_mappings() | ||
ubunt -> debian, # 1 enum::add_mapping() | ||
} | ||
|
||
resource comman(p0) # 3 ast::add_resources() | ||
commandq state execution(){} # 3 ast::add_resources() | ||
|
||
resource Configure_NTP() | ||
|
||
Configure_NP state technique() { # 3 ast::add_resources() | ||
@component = "Package present" | ||
packae("ntp").preent("","","") as package_present_ntp # respectively 4 + 5 ast::binding_check() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@format=0 | ||
|
||
@name="Configure NTP" | ||
@description="test" | ||
@version="1.0" | ||
@parameters=[] | ||
|
||
resource Configure_NTP() | ||
|
||
Configure_NTP state technique() { | ||
@component = "Package present" | ||
package("ntp").present("","","") as package_present_ntp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@format=0 | ||
enum generations { | ||
ascendant, | ||
descendant, | ||
sibbling | ||
} | ||
enum generations ~> familytree { | ||
ascendant -> dad, | ||
descendant -> son, | ||
sibbling -> sister | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@format=0 | ||
@metadata=1 | ||
resource Configure_NTP() | ||
Configure_NTP state technique() { | ||
case { | ||
# this case makes no sense, testing purpose | ||
os=~ubuntu => file("/tmp").absent(), | ||
os=~os:debian => file("/tmp").present(), | ||
default => log "info: ok" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@format=0 | ||
resource Rname (a,b,c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name cdt | ||
# @description rudderlang cdt for a complete loop | ||
# @version 1.0 | ||
|
||
|
||
bundle agent cdt | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"File absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("File absent", "tmp"), | ||
if => concat("debian"); | ||
"File absent_${report_data.directive_id}_0" usebundle => file_absent("tmp"), | ||
if => concat("debian"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/condition_anybsd/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name condition any bsd | ||
# @description Kernel simplest | ||
# @version 1.0 | ||
|
||
|
||
bundle agent condition_anybsd | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Kernel module loaded_${report_data.directive_id}_0" usebundle => _method_reporting_context("Kernel module loaded", "test"), | ||
if => concat("(dragonfly|freebsd|netbsd|openbsd)"); | ||
"Kernel module loaded_${report_data.directive_id}_0" usebundle => kernel_module_loaded("test"), | ||
if => concat("(dragonfly|freebsd|netbsd|openbsd)"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/condition_dyn/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name condition dyn | ||
# @description | ||
# @version 1.0 | ||
|
||
|
||
bundle agent condition_dyn | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Command execution_${report_data.directive_id}_0" usebundle => _method_reporting_context("Command execution", "pwd"), | ||
if => concat("any.(",canonify("${coucou}"),")"); | ||
"Command execution_${report_data.directive_id}_0" usebundle => command_execution("pwd"), | ||
if => concat("any.(",canonify("${coucou}"),")"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/condition_err/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name condition err | ||
# @description one method with several conditons | ||
# @version 1.0 | ||
|
||
|
||
bundle agent condition_err | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => _method_reporting_context("HTTP request check status with headers", "/myurl"), | ||
if => concat("debian.(cdt)"); | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => http_request_check_status_headers("GET", "/myurl", "200", ""), | ||
if => concat("debian.(cdt)"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/condition_errorprone/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name condition_errorprone | ||
# @description | ||
# @version 1.0 | ||
|
||
|
||
bundle agent condition_errorprone | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Command execution_${report_data.directive_id}_0" usebundle => _method_reporting_context("Command execution", "pwd"), | ||
if => concat("(dragonfly|openbsd)"); | ||
"Command execution_${report_data.directive_id}_0" usebundle => command_execution("pwd"), | ||
if => concat("(dragonfly|openbsd)"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/conditional_method/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name conditional method | ||
# @description one method with several conditons | ||
# @version 1.0 | ||
|
||
|
||
bundle agent conditional_method | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => _method_reporting_context("HTTP request check status with headers", "/myurl"), | ||
if => concat("debian"); | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => http_request_check_status_headers("GET", "/myurl", "200", ""), | ||
if => concat("debian"); | ||
} |
21 changes: 21 additions & 0 deletions
21
rudder-lang/tests/test_files/tester/conditional_method/technique.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "conditional method", | ||
"description": "one method with several conditons", | ||
"version": "1.0", | ||
"bundle_name": "conditional_method", | ||
"bundle_args": [], | ||
"parameter": [], | ||
"method_calls": [ | ||
{ | ||
"class_context": "debian", | ||
"component": "HTTP request check status with headers", | ||
"method_name": "http_request_check_status_headers", | ||
"args": [ | ||
"GET", | ||
"/myurl", | ||
"200", | ||
"" | ||
] | ||
} | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
rudder-lang/tests/test_files/tester/conditional_method/technique.rl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file has been generated with rltranslate | ||
@format=0 | ||
|
||
@name="conditional method" | ||
@description="one method with several conditons" | ||
@version="1.0" | ||
@parameters=[] | ||
|
||
resource conditional_method() | ||
|
||
conditional_method state technique() { | ||
@component = "HTTP request check status with headers" | ||
if debian => http("GET").request_check_status_headers("/myurl","200","") as http_request_check_status_headers__myurl | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/conditional_method/technique.rl.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# generated by rudder-lang | ||
# @name conditional method | ||
# @description one method with several conditons | ||
# @version 1.0 | ||
|
||
bundle agent conditional_method_technique | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => _method_reporting_context("HTTP request check status with headers", "/myurl"), | ||
if => concat("debian"); | ||
"HTTP request check status with headers_${report_data.directive_id}_0" usebundle => http_request_check_status_headers("GET", "/myurl", "200", ""), | ||
if => concat("debian"); | ||
} |
21 changes: 21 additions & 0 deletions
21
rudder-lang/tests/test_files/tester/conditional_method/technique.rl.cf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "conditional method", | ||
"description": "one method with several conditons", | ||
"version": "1.0", | ||
"bundle_name": "conditional_method_technique", | ||
"bundle_args": [], | ||
"parameter": [], | ||
"method_calls": [ | ||
{ | ||
"class_context": "debian", | ||
"component": "HTTP request check status with headers", | ||
"method_name": "http_request_check_status_headers", | ||
"args": [ | ||
"GET", | ||
"/myurl", | ||
"200", | ||
"" | ||
] | ||
} | ||
] | ||
} |
35 changes: 35 additions & 0 deletions
35
rudder-lang/tests/test_files/tester/multiple_simple/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# @name multiple_simple | ||
# @description | ||
# @version 1.0 | ||
|
||
|
||
bundle agent multiple_simple | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"File absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("File absent", "/tmp"), | ||
if => concat("any"); | ||
"File absent_${report_data.directive_id}_0" usebundle => file_absent("/tmp"), | ||
if => concat("any"); | ||
"File check exists_${report_data.directive_id}_1" usebundle => _method_reporting_context("File check exists", "/tmp"), | ||
if => concat("any"); | ||
"File check exists_${report_data.directive_id}_1" usebundle => file_check_exists("/tmp"), | ||
if => concat("any"); | ||
"File present_${report_data.directive_id}_2" usebundle => _method_reporting_context("File present", "/tmp"), | ||
if => concat("any"); | ||
"File present_${report_data.directive_id}_2" usebundle => file_present("/tmp"), | ||
if => concat("any"); | ||
"Directory absent_${report_data.directive_id}_3" usebundle => _method_reporting_context("Directory absent", "/tmp"), | ||
if => concat("any"); | ||
"Directory absent_${report_data.directive_id}_3" usebundle => directory_absent("/tmp", "false"), | ||
if => concat("any"); | ||
"Directory present_${report_data.directive_id}_4" usebundle => _method_reporting_context("Directory present", "/tmp"), | ||
if => concat("any"); | ||
"Directory present_${report_data.directive_id}_4" usebundle => directory_present("/tmp"), | ||
if => concat("any"); | ||
"Directory check exists_${report_data.directive_id}_5" usebundle => _method_reporting_context("Directory check exists", "/tmp"), | ||
if => concat("any"); | ||
"Directory check exists_${report_data.directive_id}_5" usebundle => directory_check_exists("/tmp"), | ||
if => concat("any"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/parameters/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name parameters | ||
# @description technique using parameters | ||
# @version 1.0 | ||
# @parameter { "name": "paramtest", "id": "d74a03dd-5b0b-4b06-8dcf-b4e0cb387c60" } | ||
|
||
bundle agent parameters(paramtest) | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Package absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("Package absent", "vpn"), | ||
if => concat("any"); | ||
"Package absent_${report_data.directive_id}_0" usebundle => package_absent("vpn", "", "", ""), | ||
if => concat("any"); | ||
} |
15 changes: 15 additions & 0 deletions
15
rudder-lang/tests/test_files/tester/parameters_err/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name parameters mult err | ||
# @description technique using multiple parameters | ||
# @version 1.0 | ||
# @parameter { "name": "${coucou}", "id": "ac15b0bd-a226-4ad7-b93c-5515cae507a1" } | ||
|
||
bundle agent parameters_mult_err(__coucou_) | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Package absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("Package absent", "vpn"), | ||
if => concat("any"); | ||
"Package absent_${report_data.directive_id}_0" usebundle => package_absent("vpn", "", "", ""), | ||
if => concat("any"); | ||
} |
16 changes: 16 additions & 0 deletions
16
rudder-lang/tests/test_files/tester/parameters_mult/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# @name parameters mult | ||
# @description technique using multiple parameters | ||
# @version 1.0 | ||
# @parameter { "name": "paramtest", "id": "d74a03dd-5b0b-4b06-8dcf-b4e0cb387c60" } | ||
# @parameter { "name": "12", "id": "6e82d276-1181-4596-8fd8-bc3c007ae9ff" } | ||
|
||
bundle agent parameters_mult(paramtest,12) | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"Package absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("Package absent", "vpn"), | ||
if => concat("any"); | ||
"Package absent_${report_data.directive_id}_0" usebundle => package_absent("vpn", "", "", ""), | ||
if => concat("any"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# @name simplest | ||
# @description rudderlang simplest for a complete loop | ||
# @version 1.0 | ||
|
||
|
||
bundle agent simplest | ||
{ | ||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
methods: | ||
"File absent_${report_data.directive_id}_0" usebundle => _method_reporting_context("File absent", "tmp"), | ||
if => concat("scientific_linux"); | ||
"File absent_${report_data.directive_id}_0" usebundle => file_absent("tmp"), | ||
if => concat("scientific_linux"); | ||
} |
Oops, something went wrong.