pub struct PlatformValidator;
Expand description
Platform compatibility and system requirements validator.
The PlatformValidator
provides static methods for checking platform
compatibility, validating Ansible installation, and verifying that all
required components are available.
§Examples
§Basic Platform Check
use ansible::PlatformValidator;
// Check if current platform is supported
PlatformValidator::check_platform()?;
// Check platform compatibility without panicking
if PlatformValidator::is_platform_supported() {
println!("Platform is supported");
} else {
println!("Platform not supported");
}
§Ansible Installation Check
use ansible::PlatformValidator;
// Check if Ansible is installed
match PlatformValidator::check_ansible_installation() {
Ok(version) => println!("Ansible version: {}", version),
Err(e) => eprintln!("Ansible not found: {}", e),
}
§Component Availability
use ansible::PlatformValidator;
// Check individual components
let components = [
("ansible", PlatformValidator::check_ansible_installation as fn() -> Result<String, _>),
("ansible-playbook", PlatformValidator::check_ansible_playbook as fn() -> Result<String, _>),
("ansible-vault", PlatformValidator::check_ansible_vault as fn() -> Result<String, _>),
];
for (name, check_fn) in &components {
match check_fn() {
Ok(_) => println!("✅ {} is available", name),
Err(_) => println!("❌ {} is not available", name),
}
}
Implementations§
Source§impl PlatformValidator
impl PlatformValidator
Sourcepub fn check_platform() -> Result<()>
pub fn check_platform() -> Result<()>
Check if the current platform is supported
Sourcepub fn check_ansible_installation() -> Result<String>
pub fn check_ansible_installation() -> Result<String>
Check if Ansible is installed and accessible
Sourcepub fn check_ansible_playbook() -> Result<String>
pub fn check_ansible_playbook() -> Result<String>
Check if ansible-playbook is available
Sourcepub fn check_ansible_vault() -> Result<String>
pub fn check_ansible_vault() -> Result<String>
Check if ansible-vault is available
Sourcepub fn check_ansible_config() -> Result<String>
pub fn check_ansible_config() -> Result<String>
Check if ansible-config is available
Sourcepub fn check_ansible_inventory() -> Result<String>
pub fn check_ansible_inventory() -> Result<String>
Check if ansible-inventory is available
Sourcepub fn check_all_requirements() -> Result<SystemInfo>
pub fn check_all_requirements() -> Result<SystemInfo>
Comprehensive system check
Sourcepub fn minimum_ansible_version() -> &'static str
pub fn minimum_ansible_version() -> &'static str
Get minimum required Ansible version
Sourcepub fn supported_platforms() -> Vec<&'static str>
pub fn supported_platforms() -> Vec<&'static str>
Get supported platforms
Sourcepub fn is_platform_supported() -> bool
pub fn is_platform_supported() -> bool
Check if current platform is supported
Auto Trait Implementations§
impl Freeze for PlatformValidator
impl RefUnwindSafe for PlatformValidator
impl Send for PlatformValidator
impl Sync for PlatformValidator
impl Unpin for PlatformValidator
impl UnwindSafe for PlatformValidator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more