impl subscriber
This commit is contained in:
+20
-1
@@ -48,6 +48,25 @@ impl Job {
|
||||
Ok(Message::check_deploy(self.id.try_into().unwrap(), ""))
|
||||
}
|
||||
|
||||
fn check_megaport(&mut self) -> Result<Message, String> {
|
||||
self.set_status(RunnerStatus::Running);
|
||||
println!(
|
||||
"[job({} - {:?} - {:?})] checking megaport...",
|
||||
self.id, self.action, self.status
|
||||
);
|
||||
|
||||
let wait = time::Duration::from_millis(50);
|
||||
thread::sleep(wait);
|
||||
|
||||
self.set_status(RunnerStatus::Success);
|
||||
println!(
|
||||
"[job({} - {:?} - {:?})] checking megaport done",
|
||||
self.id, self.action, self.status
|
||||
);
|
||||
|
||||
Ok(Message::check_deploy(self.id.try_into().unwrap(), ""))
|
||||
}
|
||||
|
||||
fn set_status(&mut self, status: RunnerStatus) {
|
||||
self.status = status;
|
||||
}
|
||||
@@ -58,7 +77,7 @@ impl Runner for Job {
|
||||
match self.action {
|
||||
JobAction::MegaportDeploy => self.deploy_megaport(),
|
||||
JobAction::MegaportUndeploy => todo!(),
|
||||
JobAction::MegaportCheckDeploy => todo!(),
|
||||
JobAction::MegaportCheckDeploy => self.check_megaport(),
|
||||
JobAction::MegaportCheckUndeploy => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user