Skip to content

Commit

Permalink
Fixes #26089: Implement augeas module
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Jan 15, 2025
1 parent a7fd52c commit 03c5a34
Show file tree
Hide file tree
Showing 45 changed files with 3,919 additions and 4,044 deletions.
1,095 changes: 752 additions & 343 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = ["policies/rudderc",
"policies/rudder-commons-test",
"policies/rudder-report",
"policies/module-types/*",
"policies/minifusion",
"relay/sources/relayd",
"relay/sources/rudder-package"]
resolver = "2"
Expand Down
1 change: 1 addition & 0 deletions policies/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build:
check:
cd rudderc && make check
cd module-types/system-updates && make check
cd module-types/augeas && make check

install:
cd rudderc && make install
35 changes: 34 additions & 1 deletion policies/lib/tree/20_cfe_basics/files.cf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#
#####################################################################################


bundle edit_line ncf_insert_block(block)
{
insert_lines:
Expand Down Expand Up @@ -742,3 +741,37 @@ body file_select date_pattern(age, pattern)
leaf_name => { "${pattern}" };
file_result => "leaf_name.mtime";
}

########################################################################
# Custom promise type #
########################################################################

promise agent augeas
{
path => "/opt/rudder/bin/rudder-module-augeas";
}

bundle agent ncf_augeas(script, if_script, context, path, show_diff, lens)
{
classes:
"pass3" expression => "pass2";
"pass2" expression => "pass1";
"pass1" expression => "any";

pass2.!pass3::
augeas:
"${report_data.method_id}"
rudder_module_protocol => "0",
state_dir => "/var/rudder/system-update/",
node_id => "${g.uuid}",
agent_frequency_minutes => "${g.agent_run_interval}",
classes => classes_generic("${report_data.method_id}"),
data => parsejson('{
"script": "${script}",
"if_script": "${if_script}",
"context": "${context}",
"path": "${path}",
"show_diff": ${show_diff},
"lens": "${lens}",
}');
}
94 changes: 0 additions & 94 deletions policies/minifusion/src/properties.rs

This file was deleted.

14 changes: 13 additions & 1 deletion policies/module-types/augeas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ license.workspace = true

[dependencies]
anyhow = "1"
bytesize = { version = "1.3.0" }
gumdrop = "0.8.1"
ipnet = "2.0.0"
iprange = { version = "0.6" }
nom = "7"
miette = { version = "7.4.0", features = ["fancy"] }
thiserror = "2"
chumsky = { version = "1.0.0-alpha.7", features = ["pratt", "label"] }
ariadne = "0.2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde-inline-default = "0.2"
serde_with = "3"
similar = "2.6.0"
regex = "1.11.1"
rudder_module_type = { path = "../../rudder-module-type" }
raugeas = { git = "https://github.com/Normation/raugeas.git" }
raugeas = "0.3.0"
rustyline = "15"
zxcvbn = "3"

[dev-dependencies]
rudder_commons_test = { path = "../../rudder-commons-test" }
Expand Down
2 changes: 2 additions & 0 deletions policies/module-types/augeas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Augeas module type.
This module provides a type to manage configuration files using Augeas.
It uses the C API through Rust bindings.

Provide an improved experience of Augeas.

## Usage

There are different ways to use this module:
Expand Down
Loading

0 comments on commit 03c5a34

Please sign in to comment.