Skip to content

Commit 3481c34

Browse files
committed
refactor: move generic command wrappers to dedicated module
Move ansible.rs, ssh.rs, lxd/, and opentofu/ modules into a new command_wrappers/ directory to better organize generic command wrappers that contain no app-specific logic. These wrappers could be moved to a shared workspace package in the future for use across other Torrust projects. Changes: - Create src/command_wrappers/ with proper module structure - Move all generic command wrappers to new location - Update all import statements across the codebase - Add re-exports for maintaining API compatibility - Update library documentation to reflect new organization - Fix clippy documentation lint issue
1 parent 5014c11 commit 3481c34

File tree

17 files changed

+27
-18
lines changed

17 files changed

+27
-18
lines changed

src/actions/cloud_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::Path;
22
use tracing::info;
33

44
use crate::actions::{RemoteAction, RemoteActionError};
5-
use crate::ssh::SshClient;
5+
use crate::command_wrappers::ssh::SshClient;
66

77
/// Action that checks if cloud-init has completed successfully on the server
88
pub struct CloudInitValidator {

src/actions/docker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::Path;
22
use tracing::{info, warn};
33

44
use crate::actions::{RemoteAction, RemoteActionError};
5-
use crate::ssh::SshClient;
5+
use crate::command_wrappers::ssh::SshClient;
66

77
/// Action that validates Docker installation and daemon status on the server
88
pub struct DockerValidator {

src/actions/docker_compose.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::Path;
22
use tracing::{info, warn};
33

44
use crate::actions::{RemoteAction, RemoteActionError};
5-
use crate::ssh::SshClient;
5+
use crate::command_wrappers::ssh::SshClient;
66

77
/// Action that validates Docker Compose installation and basic functionality on the server
88
pub struct DockerComposeValidator {

src/bin/e2e_tests.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use tempfile::TempDir;
77
use tracing_subscriber::fmt;
88

99
// Import command execution system
10-
use torrust_tracker_deploy::ansible::AnsibleClient;
11-
use torrust_tracker_deploy::lxd::LxdClient;
12-
use torrust_tracker_deploy::opentofu::OpenTofuClient;
13-
use torrust_tracker_deploy::ssh::SshClient;
10+
use torrust_tracker_deploy::command_wrappers::ansible::AnsibleClient;
11+
use torrust_tracker_deploy::command_wrappers::lxd::LxdClient;
12+
use torrust_tracker_deploy::command_wrappers::opentofu::OpenTofuClient;
13+
use torrust_tracker_deploy::command_wrappers::ssh::SshClient;
1414
use torrust_tracker_deploy::stages::{ConfigurationTemplateRenderer, ProvisionTemplateRenderer};
1515
// Import template system
1616
use torrust_tracker_deploy::template::wrappers::ansible::inventory::{
@@ -280,9 +280,7 @@ impl Drop for TestEnvironment {
280280
// Using emergency_destroy for consistent OpenTofu handling
281281
let tofu_dir = self.build_dir.join("tofu/lxd");
282282

283-
drop(torrust_tracker_deploy::opentofu::emergency_destroy(
284-
&tofu_dir,
285-
));
283+
drop(torrust_tracker_deploy::command_wrappers::opentofu::emergency_destroy(&tofu_dir));
286284
}
287285
}
288286
}

0 commit comments

Comments
 (0)