From 72934089c456b533f3a4b90ebe38b082fe1c9697 Mon Sep 17 00:00:00 2001 From: Olivier Benaben <31973542+ce7elem@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:21:22 -0800 Subject: [PATCH] Add `Clone` and `Debug` traits for `rs_ansible::AnsiblePlaybookCommand` (#15) * feat: add `Clone` and `Debug` traits for AnsiblePlaybookCommand --- src/executor.rs | 2 +- src/options.rs | 3 ++- src/playbook.rs | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/executor.rs b/src/executor.rs index 72217c9..a13739d 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -9,7 +9,7 @@ pub fn verify_binary(binary: &str) -> Result<(), Box> { } } -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct DefaultExecutor {} impl DefaultExecutor { diff --git a/src/options.rs b/src/options.rs index 576e26f..0f16d4d 100644 --- a/src/options.rs +++ b/src/options.rs @@ -18,6 +18,7 @@ pub fn ansible_set_env(key: &str, value: &str) { /// Has those parameters described on `Connections Options` section within /// ansible-playbook's man page, and which defines how to connect to hosts. +#[derive(Debug, Clone)] pub struct AnsibleConnectionOptions { pub ask_pass: bool, pub connection: String, @@ -136,7 +137,7 @@ impl AnsibleConnectionOptions { machinectl Systemd's machinectl privilege escalation dzdo Centrify's Direct Authorize */ -#[derive(Default)] +#[derive(Debug, Default, Clone)] pub struct AnsiblePrivilegeEscalationOptions { pub ask_become_pass: bool, pub do_become: bool, diff --git a/src/playbook.rs b/src/playbook.rs index 4396068..b2f9b20 100644 --- a/src/playbook.rs +++ b/src/playbook.rs @@ -7,6 +7,7 @@ use std::process::Child; /// Parameters described on `Options` section within /// ansible-playbook's man page, and which defines which should be /// the ansible-playbook execution behavior. +#[derive(Debug, Clone)] pub struct AnsiblePlaybookOptions { pub ask_vault_password: bool, // ask for vault password pub check: bool, // don't make any changes; instead, try to predict some of the changes that may occur @@ -235,6 +236,7 @@ impl AnsiblePlaybookOptions { } /// Ansible-playbook command representation and how to execute it +#[derive(Debug, Clone)] pub struct AnsiblePlaybookCmd { pub binary: String, // Ansible binary pub executor: DefaultExecutor, // Ansible binary