Skip to main content

Module command

Module command 

Source
Expand description

Shell command execution attribute

This module provides the CommandBlockExpectedState type for executing arbitrary shell commands on managed hosts.

Compatible OS:

  • All POSIX systems (Linux, macOS, FreeBSD) - uses run_command
  • Windows (when windows feature is enabled) - uses run_windows_command

§Examples

§Rust API

use regent_sdk::state::attribute::shell::command::CommandBlockExpectedState;
use regent_sdk::{Attribute, ExpectedState, Privilege};

// Execute a simple command
let echo = CommandBlockExpectedState::builder("echo 'Hello, World!'")
    .build()
    .unwrap();

let expected_state = ExpectedState::new()
    .with_attribute(Attribute::command(echo, Privilege::None, None))
    .build();

§YAML API

Attributes:
  - Name: Hello world must be printed
    Privilege: !None
    Detail: !Command
      Cmd: "echo 'Hello, World!'"

Structs§

CommandApiCall
CommandBlockExpectedState
Configuration for a shell command to execute