Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! wip
Browse files Browse the repository at this point in the history
Fixes #26089: Implement augeas module
  • Loading branch information
amousset committed Jan 12, 2025
1 parent 8e8e1e2 commit 4501f31
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 160 deletions.
9 changes: 8 additions & 1 deletion policies/arch-doc/modules/src/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,20 @@ Our set of requirements for choosing a target language are:
- Reliability: We want to enjoy the benefits of a modern language, with a strong type system and good error handling,
matching our other stacks (Scala & Elm).

And also, obviously, we would rather reuse a language we already use in Rudder.

We could consider using two languages, one for the engine and one for the resource
implementations as the needs are a bit different.
For now the core is already there (CFEngine on Linux,
F#/Powershell on Windows), so we can focus on the resources for now.

This lead to the choice of Rust for the resources. It matches most of our
needs, and we also enjoy using it in other parts of Rudder.
The usage of Rust in Rudder until now was limited to the server:

* `relayd` (since 2019, Rudder 6.0): A network service to relay messages between the server and the agents.
* `rudderc` (since 2023, Rudder 8.0): A transpiler for transforming the Rudder policy language to the agent language.
* `rudder-package` (since 2024, Rudder 8.1): The package manager for Rudder plugins.

The possible drawbacks are:

Expand All @@ -965,7 +972,7 @@ Rust is already used for successful infrastructure software:
* Azure is using it for some of its services
* etc.

## Policies / User interface
## Policies & user interface

It the resource level, passing data is enough, and the engine itself could
use data structures, or a DSL to describe the policies.
Expand Down
3 changes: 1 addition & 2 deletions policies/module-types/augeas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ iprange = { version = "0.6" }
nom = "7"
miette = { version = "7.4.0", features = ["fancy"] }
thiserror = "2"
chumsky = "1.0.0-alpha.7"
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"
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"
Expand Down
3 changes: 2 additions & 1 deletion policies/module-types/augeas/src/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod error;
mod interpreter;
mod ip;
mod parser;
mod parser_chumsky;
mod password;
pub mod repl;
pub mod script;
Expand All @@ -18,7 +19,7 @@ pub type Value<'a> = &'a str;
pub type Sub<'a> = &'a str;

/// A path in the Augeas tree.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct AugPath<'a> {
inner: &'a str,
}
Expand Down
Loading

0 comments on commit 4501f31

Please sign in to comment.