Skip to content

Commit 1bc08a2

Browse files
committed
stackspec in uninstall refactoring
1 parent 5574319 commit 1bc08a2

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

  • rust
    • stackable-cockpit/src/platform/demo
    • stackablectl/src/cmds

rust/stackable-cockpit/src/platform/demo/spec.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
demo::{DemoInstallParameters, DemoUninstallParameters},
1414
manifests::{self, InstallManifestsExt},
1515
release::ReleaseList,
16-
stack::{self, StackInstallParameters, StackList, StackSpec},
16+
stack::{self, StackInstallParameters, StackList},
1717
},
1818
utils::{
1919
k8s::{self, Client},
@@ -200,12 +200,17 @@ impl DemoSpec {
200200
))]
201201
pub async fn uninstall(
202202
&self,
203+
stack_list: StackList,
203204
release_list: ReleaseList,
204205
uninstall_parameters: DemoUninstallParameters,
205206
client: &Client,
206207
transfer_client: &xfer::Client,
207-
stack: StackSpec,
208208
) -> Result<(), Error> {
209+
// Get the stack spec based on the name defined in the demo spec
210+
let stack = stack_list.get(&self.stack).context(NoSuchStackSnafu {
211+
name: self.stack.clone(),
212+
})?;
213+
209214
// Uninstall Helm Charts
210215
let parameters = &mut Vec::new()
211216
.into_params(self.parameters.clone())

rust/stackablectl/src/cmds/demo.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ pub enum CmdError {
147147
#[snafu(display("no demo with name {name:?}"))]
148148
NoSuchDemo { name: String },
149149

150-
#[snafu(display("no stack with name {name:?}"))]
151-
NoSuchStack { name: String },
152-
153150
#[snafu(display("no release {release:?}"))]
154151
NoSuchRelease { release: String },
155152

@@ -529,11 +526,6 @@ async fn uninstall_cmd(
529526
.await
530527
.context(BuildListSnafu)?;
531528

532-
// Get the stack spec based on the name defined in the demo spec
533-
let stack = stack_list.get(&demo.stack).context(NoSuchStackSnafu {
534-
name: demo.stack.clone(),
535-
})?;
536-
537529
let client = Client::new().await.context(KubeClientCreateSnafu)?;
538530

539531
let release_files = cli.get_release_files().context(PathOrUrlParseSnafu)?;
@@ -542,6 +534,7 @@ async fn uninstall_cmd(
542534
.context(BuildListSnafu)?;
543535

544536
demo.uninstall(
537+
stack_list,
545538
release_list,
546539
DemoUninstallParameters {
547540
demo_name: args.demo_name.clone(),
@@ -552,7 +545,6 @@ async fn uninstall_cmd(
552545
},
553546
&client,
554547
transfer_client,
555-
stack.to_owned(),
556548
)
557549
.await
558550
.context(UninstallDemoSnafu {

0 commit comments

Comments
 (0)