Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix graphman deploy command logic when creating subgraph #5740

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions node/src/manager/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,22 @@ pub async fn run(
_ => bail!("The `name` must be a valid subgraph name"),
};

if create {
println!("Creating subgraph `{}`", name);
let subgraph_name =
SubgraphName::new(name.clone()).map_err(|_| anyhow!("Invalid subgraph name"))?;
let subgraph_name =
SubgraphName::new(name.clone()).map_err(|_| anyhow!("Invalid subgraph name"))?;

let exists = subgraph_store.subgraph_exists(&subgraph_name)?;
let exists = subgraph_store.subgraph_exists(&subgraph_name)?;

if exists {
bail!("Subgraph with name `{}` already exists", name);
}
if create && !exists {
println!("Creating subgraph `{}`", name);

// Send the subgraph_create request
send_create_request(&name, &url).await?;
println!("Subgraph `{}` created", name);
} else if !create && !exists {
bail!(
"Subgraph with name `{}` does not exist. Use the `--create` flag to create it",
name
);
}

// Send the subgraph_deploy request
Expand Down
Loading