forked from Normation/rudder
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sep 14, 2020
1 parent
9e3ac77
commit 0d23aba
Showing
10 changed files
with
110 additions
and
16 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
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,8 @@ | ||
use crate::{error::Result, io::IOContext, ActionResult}; | ||
|
||
// TODO Migrate: call cf_to_json perl script then call json->rl == Technique generate() | ||
/// Generates RudderLang from CFEngine | ||
pub fn migrate(ctx: &IOContext) -> Result<Vec<ActionResult>> { | ||
// Ok(vec![ActionResult::default()]) | ||
unimplemented!() | ||
} |
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 @@ | ||
use crate::{error::Result, io::IOContext, ActionResult}; | ||
|
||
pub fn generate_technique(ctx: &IOContext) -> Result<Vec<ActionResult>> { | ||
// Ok(vec![ActionResult::default()]) | ||
unimplemented!() | ||
} |
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 @@ | ||
use crate::{ | ||
compile::technique_to_ir, error::Result, generator::Format, io::IOContext, | ||
technique::Technique, ActionResult, | ||
}; | ||
use typed_arena::Arena; | ||
|
||
/// takes a RudderLang technique, and generate a JSON technique that wraps it up | ||
// TODO report errors directly into the output (+data) | ||
pub fn read_technique(ctx: &IOContext) -> Result<Vec<ActionResult>> { | ||
let sources = Arena::new(); | ||
let technique = Technique::from(&technique_to_ir(ctx, &sources)?).to_json()?; | ||
|
||
// TODO Option -> output -> Some else None | ||
// TODO deal with errors (implement) | ||
Ok(vec![ActionResult::new(Format::JSON, Some(technique), None)]) | ||
} |
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,22 @@ | ||
# generated by rudderc | ||
# @name normal | ||
# @version unknown | ||
|
||
bundle agent normal_technique(parameter_wdd, paramtest) { | ||
|
||
vars: | ||
"resources_dir" string => "${this.promise_dirname}/resources"; | ||
"args" slist => {"parameter_wdd", "paramtest"}; | ||
"report_param" string => join("_", args); | ||
"full_class_prefix" string => canonify("normal_technique_${report_param}"); | ||
"class_prefix" string => string_head("${full_class_prefix}", "1000"); | ||
|
||
methods: | ||
# Condition once: | ||
# | ||
# condition("mycond").once() as condition_once_mycond | ||
# | ||
"${report_data.directive_id}_0" usebundle => _method_reporting_context("Condition once", "mycond"); | ||
"${report_data.directive_id}_0" usebundle => condition_once("mycond"); | ||
|
||
} |
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,38 @@ | ||
{ | ||
"type": "ncf_technique", | ||
"version": 2, | ||
"data": { | ||
"bundle_name": "normal", | ||
"description": "ewf", | ||
"name": "normal", | ||
"version": 0, | ||
"parameter": [ | ||
{ | ||
"id": "c6e6cc3a-9ce8-4889-bccc-6bfc1b091d0d", | ||
"name": "parameter wdd", | ||
"description": "" | ||
}, | ||
{ | ||
"id": "d74a03dd-5b0b-4b06-8dcf-b4e0cb387c60", | ||
"name": "paramtest", | ||
"description": "" | ||
} | ||
], | ||
"category": "", | ||
"method_calls": [ | ||
{ | ||
"parameters": [ | ||
{ | ||
"name": "condition_prefix", | ||
"value": "mycond", | ||
"$errors": [] | ||
} | ||
], | ||
"class_context": "any", | ||
"method_name": "condition_once", | ||
"component": "Condition once" | ||
} | ||
], | ||
"resources": [] | ||
} | ||
} |