swarmctl: drop the controller socket target, the host has no socket to reach
This commit is contained in:
parent
ee6b5f69f6
commit
62c206169c
1 changed files with 174 additions and 599 deletions
|
|
@ -11,7 +11,7 @@ use swarm_controller_api::schedules::{
|
|||
};
|
||||
|
||||
use crate::agent::{parse_ident, send};
|
||||
use crate::remote::Target;
|
||||
use crate::remote::Swarm;
|
||||
|
||||
/// What `schedule edit` was asked to change.
|
||||
pub(crate) struct EditFlags<'a> {
|
||||
|
|
@ -94,7 +94,7 @@ pub(crate) struct AddFlags<'a> {
|
|||
}
|
||||
|
||||
/// Run `swarmctl schedule add`.
|
||||
pub(crate) fn add(target: &Target, flags: &AddFlags<'_>) -> Result<()> {
|
||||
pub(crate) fn add(target: &Swarm, flags: &AddFlags<'_>) -> Result<()> {
|
||||
let request = AddScheduleRequest {
|
||||
name: flags.name.to_owned(),
|
||||
agents: agents(flags.agents)?,
|
||||
|
|
@ -116,7 +116,7 @@ pub(crate) fn add(target: &Target, flags: &AddFlags<'_>) -> Result<()> {
|
|||
}
|
||||
|
||||
/// Run `swarmctl schedule list`, optionally only the schedules naming `agent`.
|
||||
pub(crate) fn list(target: &Target, agent: Option<&str>) -> Result<()> {
|
||||
pub(crate) fn list(target: &Swarm, agent: Option<&str>) -> Result<()> {
|
||||
let agent = agent.map(|a| parse_ident(a, "agent name")).transpose()?;
|
||||
let schedules: Vec<ScheduleView> = runtime()?.block_on(send(
|
||||
target,
|
||||
|
|
@ -139,7 +139,7 @@ pub(crate) fn list(target: &Target, agent: Option<&str>) -> Result<()> {
|
|||
}
|
||||
|
||||
/// Run `swarmctl schedule edit`.
|
||||
pub(crate) fn edit(target: &Target, id: &str, edit: &EditScheduleRequest) -> Result<()> {
|
||||
pub(crate) fn edit(target: &Swarm, id: &str, edit: &EditScheduleRequest) -> Result<()> {
|
||||
let edited: ScheduleView = runtime()?.block_on(send(
|
||||
target,
|
||||
hyper::Method::PATCH,
|
||||
|
|
@ -152,12 +152,12 @@ pub(crate) fn edit(target: &Target, id: &str, edit: &EditScheduleRequest) -> Res
|
|||
}
|
||||
|
||||
/// Run `swarmctl schedule pause` or `resume`.
|
||||
pub(crate) fn set_paused(target: &Target, id: &str, paused: bool) -> Result<()> {
|
||||
pub(crate) fn set_paused(target: &Swarm, id: &str, paused: bool) -> Result<()> {
|
||||
edit(target, id, &paused_edit(paused))
|
||||
}
|
||||
|
||||
/// Run `swarmctl schedule rm`.
|
||||
pub(crate) fn remove(target: &Target, id: &str) -> Result<()> {
|
||||
pub(crate) fn remove(target: &Swarm, id: &str) -> Result<()> {
|
||||
let uri = member(id)?;
|
||||
runtime()?.block_on(send::<(), ()>(
|
||||
target,
|
||||
|
|
|
|||
Loading…
Reference in a new issue