Move the ExecutableTask to the root of zap-models

This commit is contained in:
R Tyler Croy 2021-01-01 10:12:57 -08:00
parent a3accf213a
commit 872157ce98
5 changed files with 24 additions and 15 deletions

View File

@ -10,8 +10,9 @@ mod transport;
use crate::inventory::*;
use crate::transport::ssh::Ssh;
use zap_model::plan::{ExecutableTask, Plan};
use zap_model::plan::Plan;
use zap_model::task::Task;
use zap_model::ExecutableTask;
fn main() {
pretty_env_logger::init();

View File

@ -1,6 +1,6 @@
use crate::inventory::{Group, Inventory, Target};
use std::path::Path;
use zap_model::plan::ExecutableTask;
use zap_model::ExecutableTask;
pub mod ssh;

View File

@ -10,7 +10,7 @@ use std::io::BufReader;
use std::net::TcpStream;
use std::path::Path;
use zap_model::plan::ExecutableTask;
use zap_model::ExecutableTask;
#[derive(Clone)]
pub struct Ssh {

View File

@ -3,5 +3,23 @@ extern crate pest;
#[macro_use]
extern crate pest_derive;
use std::collections::HashMap;
pub mod plan;
pub mod task;
/**
* An ExecutableTask is a light container over a Task execpt with user-provided information and is
* therefore ready for execution
*/
#[derive(Clone, Debug)]
pub struct ExecutableTask {
pub task: task::Task,
pub parameters: HashMap<String, String>,
}
impl ExecutableTask {
pub fn new(task: task::Task, parameters: HashMap<String, String>) -> Self {
Self { task, parameters }
}
}

View File

@ -6,22 +6,12 @@ use pest::Parser;
use std::collections::HashMap;
use std::path::PathBuf;
use crate::ExecutableTask;
#[derive(Parser)]
#[grammar = "plan.pest"]
struct PlanParser;
#[derive(Clone, Debug)]
pub struct ExecutableTask {
pub task: crate::task::Task,
pub parameters: HashMap<String, String>,
}
impl ExecutableTask {
pub fn new(task: crate::task::Task, parameters: HashMap<String, String>) -> Self {
Self { task, parameters }
}
}
#[derive(Clone, Debug)]
pub struct Plan {
pub tasks: Vec<ExecutableTask>,