Initial project setup: README, Cargo.toml, and CLI scaffolding
- Add README with project overview, architecture, and roadmap - Set up Rust project with clap, toml, serde, tracing dependencies - Scaffold CLI with 6 commands (init, validate, diff, check, apply, rollback) - Create module structure for config, state, planner, executor, jail, vm, zfs - Create test directory structure for unit/integration/idempotency tests
This commit is contained in:
8
src/commands/mod.rs
Normal file
8
src/commands/mod.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
pub mod commands {
|
||||
pub mod init {}
|
||||
pub mod validate {}
|
||||
pub mod diff {}
|
||||
pub mod check {}
|
||||
pub mod apply {}
|
||||
pub mod rollback {}
|
||||
}
|
||||
4
src/config/mod.rs
Normal file
4
src/config/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
pub mod config {
|
||||
pub fn parse() {}
|
||||
pub fn validate() {}
|
||||
}
|
||||
3
src/executor/mod.rs
Normal file
3
src/executor/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod executor {
|
||||
pub fn execute() {}
|
||||
}
|
||||
6
src/jail/mod.rs
Normal file
6
src/jail/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
pub mod jail {
|
||||
pub fn create() {}
|
||||
pub fn destroy() {}
|
||||
pub fn start() {}
|
||||
pub fn stop() {}
|
||||
}
|
||||
8
src/lib.rs
Normal file
8
src/lib.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
pub mod config;
|
||||
pub mod state;
|
||||
pub mod planner;
|
||||
pub mod executor;
|
||||
pub mod jail;
|
||||
pub mod vm;
|
||||
pub mod zfs;
|
||||
pub mod commands;
|
||||
64
src/main.rs
Normal file
64
src/main.rs
Normal file
@@ -0,0 +1,64 @@
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "rostyr")]
|
||||
#[command(about = "FreeBSD configuration management tool", long_about = None)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
/// Scaffold new host config
|
||||
Init { hostname: String },
|
||||
/// Validate all TOML configs
|
||||
Validate,
|
||||
/// Show pending changes (dry-run)
|
||||
Diff {
|
||||
#[arg(long)]
|
||||
host: Option<String>,
|
||||
},
|
||||
/// Detect current system state
|
||||
Check {
|
||||
#[arg(long)]
|
||||
host: Option<String>,
|
||||
},
|
||||
/// Apply changes (creates ZFS snapshot first)
|
||||
Apply {
|
||||
#[arg(long)]
|
||||
host: Option<String>,
|
||||
},
|
||||
/// Revert to last ZFS snapshot
|
||||
Rollback,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
Commands::Init { hostname } => {
|
||||
println!("Initializing host: {}", hostname);
|
||||
}
|
||||
Commands::Validate => {
|
||||
println!("Validating configs...");
|
||||
}
|
||||
Commands::Diff { host } => {
|
||||
println!("Showing diff for host: {:?}", host);
|
||||
}
|
||||
Commands::Check { host } => {
|
||||
println!("Checking state for host: {:?}", host);
|
||||
}
|
||||
Commands::Apply { host } => {
|
||||
println!("Applying changes for host: {:?}", host);
|
||||
}
|
||||
Commands::Rollback => {
|
||||
println!("Rolling back...");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
3
src/planner/mod.rs
Normal file
3
src/planner/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod planner {
|
||||
pub fn diff() {}
|
||||
}
|
||||
3
src/state/mod.rs
Normal file
3
src/state/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod state {
|
||||
pub fn detect() {}
|
||||
}
|
||||
6
src/vm/mod.rs
Normal file
6
src/vm/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
pub mod vm {
|
||||
pub fn create() {}
|
||||
pub fn destroy() {}
|
||||
pub fn start() {}
|
||||
pub fn stop() {}
|
||||
}
|
||||
5
src/zfs/mod.rs
Normal file
5
src/zfs/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
pub mod zfs {
|
||||
pub fn snapshot() {}
|
||||
pub fn rollback() {}
|
||||
pub fn list() {}
|
||||
}
|
||||
Reference in New Issue
Block a user