Skip to content

Commit

Permalink
fix: check if custom spu exists on start (#3668)
Browse files Browse the repository at this point in the history
  • Loading branch information
galibey authored Nov 8, 2023
1 parent 306024a commit 8883d8b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions crates/fluvio-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,15 @@ mod root {

/// Search for a Fluvio plugin in the following places:
///
/// - In the system PATH
/// - In the directory where the `fluvio` executable is located
/// - In the system PATH
/// - In the `~/.fluvio/extensions/` directory
fn find_plugin(name: &str) -> Option<PathBuf> {
let ext_dir = fluvio_extensions_dir().ok();
let self_exe = std::env::current_exe().ok();
let self_dir = self_exe.as_ref().and_then(|it| it.parent());
which::which(name)
.or_else(|_| which::which_in(name, self_dir, "."))
which::which_in(name, self_dir, ".")
.or_else(|_| which::which(name))
.or_else(|_| which::which_in(name, ext_dir, "."))
.ok()
}
Expand Down
16 changes: 12 additions & 4 deletions crates/fluvio-cluster/src/start/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,18 @@ impl LocalInstaller {
let spec = spu_process.spec();
let admin = fluvio.admin().await;
let name = format!("custom-spu-{}", spu_process.id());
admin
.create::<CustomSpuSpec>(name, false, spec.to_owned().into())
.await?;

if admin
.list::<CustomSpuSpec, _>(vec![name.clone()])
.await?
.is_empty()
{
debug!(name, "create custom spu");
admin
.create::<CustomSpuSpec>(name, false, spec.to_owned().into())
.await?;
} else {
debug!(name, "custom spu already exists");
}
spu_process.start().map_err(|err| err.into())
}

Expand Down

0 comments on commit 8883d8b

Please sign in to comment.