Skip to content

Commit

Permalink
Merge branch 'reorganisation' of github.com:LeChatP/RootAsRole into r…
Browse files Browse the repository at this point in the history
…eorganisation
  • Loading branch information
LeChatP committed Sep 10, 2024
2 parents 880b8fc + cdfb1f1 commit 80dd903
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
36 changes: 15 additions & 21 deletions rar-common/src/database/options.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::{borrow::Borrow, cell::RefCell, rc::Rc};
#[cfg(feature = "finder")]
use std::path::PathBuf;
use std::{borrow::Borrow, cell::RefCell, rc::Rc};

use chrono::Duration;

Expand Down Expand Up @@ -551,18 +551,18 @@ pub struct OptStack {
}

type FinalPath = (
PathBehavior,
Rc<RefCell<LinkedHashSet<String>>>,
Rc<RefCell<LinkedHashSet<String>>>,
);
PathBehavior,
Rc<RefCell<LinkedHashSet<String>>>,
Rc<RefCell<LinkedHashSet<String>>>,
);

type FinalEnv = (
EnvBehavior,
HashMap<String, String>,
LinkedHashSet<EnvKey>,
LinkedHashSet<EnvKey>,
LinkedHashSet<EnvKey>,
);
EnvBehavior,
HashMap<String, String>,
LinkedHashSet<EnvKey>,
LinkedHashSet<EnvKey>,
LinkedHashSet<EnvKey>,
);

impl OptStack {
pub fn from_task(task: Rc<RefCell<STask>>) -> Self {
Expand Down Expand Up @@ -610,7 +610,7 @@ impl OptStack {

fn new(roles: Rc<RefCell<SConfig>>) -> OptStack {
let mut res = OptStack::default();
let mut opt = Opt{
let mut opt = Opt {
level: Level::Global,
root: Some(SPrivileged::User),
bounding: Some(SBounding::Strict),
Expand Down Expand Up @@ -696,9 +696,7 @@ impl OptStack {
}
}

fn get_final_path(
&self,
) -> FinalPath {
fn get_final_path(&self) -> FinalPath {
let mut final_behavior = PathBehavior::Delete;
let final_add = rc_refcell!(LinkedHashSet::new());
// Cannot use HashSet as we need to keep order
Expand Down Expand Up @@ -747,9 +745,7 @@ impl OptStack {

#[allow(dead_code)]
#[cfg(not(tarpaulin_include))]
fn union_all_path(
&self,
) -> FinalPath {
fn union_all_path(&self) -> FinalPath {
let mut final_behavior = PathBehavior::Delete;
let final_add = rc_refcell!(LinkedHashSet::new());
// Cannot use HashSet as we need to keep order
Expand Down Expand Up @@ -877,9 +873,7 @@ impl OptStack {
Ok(final_env)
}

fn get_final_env(
&self,
) -> FinalEnv {
fn get_final_env(&self) -> FinalEnv {
let mut final_behavior = EnvBehavior::default();
let mut final_set = HashMap::new();
let mut final_keep = LinkedHashSet::new();
Expand Down
2 changes: 1 addition & 1 deletion rar-common/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use strum::EnumIs;
use tracing::{debug, warn, Level};
use tracing_subscriber::util::SubscriberInitExt;

use crate::database::structs::SCommand;
#[cfg(feature = "finder")]
use crate::api::PluginManager;
use crate::database::structs::SCommand;

pub const RST: &str = "\x1B[0m";
pub const BOLD: &str = "\x1B[1m";
Expand Down
8 changes: 6 additions & 2 deletions src/chsr/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ mod tests {
.try_init();
//Write json test json file
let path = format!("{}.{}", ROOTASROLE, name);
let mut file = std::fs::File::create(path.clone()).unwrap_or_else(|_| panic!("Failed to create {:?}/{} file at",
let mut file = std::fs::File::create(path.clone()).unwrap_or_else(|_| {
panic!(
"Failed to create {:?}/{} file at",
current_dir().unwrap(),
path));
path
)
});
let mut settings = SettingsFile::default();
settings.storage.method = StorageMethod::JSON;
settings.storage.settings = Some(RemoteStorageSettings::default());
Expand Down
7 changes: 5 additions & 2 deletions src/sr/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ fn main() -> Result<(), Box<dyn Error>> {

let pty = Pty::new().expect("Failed to create pty");

debug!("Command: {:?} {:?}", execcfg.exec_path, execcfg.exec_args.join(" "));
debug!(
"Command: {:?} {:?}",
execcfg.exec_path,
execcfg.exec_args.join(" ")
);
let command = Command::new(&execcfg.exec_path)
.args(execcfg.exec_args.iter())
.env_clear()
Expand Down Expand Up @@ -319,7 +323,6 @@ fn make_cred() -> Cred {
// get parent pid
let ppid = nix::unistd::getppid();


Cred {
user,
groups,
Expand Down

0 comments on commit 80dd903

Please sign in to comment.