Skip to content

Commit 481bd24

Browse files
authored
Print proposal ID when a proposal is issued. (#1323)
1 parent 60c6704 commit 481bd24

21 files changed

Lines changed: 80 additions & 29 deletions

rs/cli/src/commands/api_boundary_nodes/add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl ExecutableCommand for Add {
3535

3636
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
3737
Submitter::from(&self.submission_parameters)
38-
.propose(
38+
.propose_and_print(
3939
ctx.ic_admin_executor().await?.execution(ic_admin::IcAdminProposal::new(
4040
ic_admin::IcAdminProposalCommand::AddApiBoundaryNodes {
4141
nodes: self.nodes.to_vec(),

rs/cli/src/commands/api_boundary_nodes/remove.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl ExecutableCommand for Remove {
3131

3232
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
3333
Submitter::from(&self.submission_parameters)
34-
.propose(
34+
.propose_and_print(
3535
ctx.ic_admin_executor().await?.execution(ic_admin::IcAdminProposal::new(
3636
ic_admin::IcAdminProposalCommand::RemoveApiBoundaryNodes { nodes: self.nodes.to_vec() },
3737
ic_admin::IcAdminProposalOptions {

rs/cli/src/commands/api_boundary_nodes/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl ExecutableCommand for Update {
3434

3535
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
3636
Submitter::from(&self.submission_parameters)
37-
.propose(
37+
.propose_and_print(
3838
ctx.ic_admin_executor().await?.execution(ic_admin::IcAdminProposal::new(
3939
ic_admin::IcAdminProposalCommand::DeployGuestosToSomeApiBoundaryNodes {
4040
nodes: self.nodes.to_vec(),

rs/cli/src/commands/firewall.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,12 @@ impl Firewall {
235235
let hash = parsed.hash;
236236
info!("Computed hash for firewall rule at position '{}': {}", positions, hash);
237237

238+
// We should probably not be calling the print variant here, since
239+
// this is called in a loop by the caller of create_proposal. Perhaps
240+
// we should summarize the proposals that were submitted, or the errors
241+
// that were returned.
238242
Submitter::from(submission_parameters)
239-
.propose(
243+
.propose_and_print(
240244
ctx.ic_admin_executor().await?.execution(FirewallModifyCommand {
241245
test_command,
242246
hash,

rs/cli/src/commands/governance/propose/motion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl ExecutableCommand for Motion {
8181
};
8282

8383
Submitter::from(&self.submission_parameters)
84-
.propose(
84+
.propose_and_print(
8585
ctx.governance_executor().await?.execution(request),
8686
ForumPostKind::Motion {
8787
title: title.clone(),

rs/cli/src/commands/hostos/rollout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl ExecutableCommand for Rollout {
3131
async fn execute(&self, ctx: crate::ctx::DreContext) -> anyhow::Result<()> {
3232
let runner_proposal = ctx.runner().await?.hostos_rollout(self.nodes.clone(), &self.version, None)?;
3333
Submitter::from(&self.submission_parameters)
34-
.propose(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
34+
.propose_and_print(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
3535
.await
3636
}
3737

rs/cli/src/commands/hostos/rollout_from_node_group.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl ExecutableCommand for RolloutFromNodeGroup {
101101

102102
let runner_proposal = runner.hostos_rollout(nodes_to_update, &self.version, Some(summary))?;
103103
Submitter::from(&self.submission_parameters)
104-
.propose(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
104+
.propose_and_print(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
105105
.await
106106
}
107107

rs/cli/src/commands/network.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ impl ExecutableCommand for Network {
177177
return Ok(());
178178
}
179179

180+
let mut submitted_proposals = vec![];
181+
180182
for proposal in proposals {
181183
if let crate::ic_admin::IcAdminProposalCommand::ChangeSubnetMembership { subnet_id, .. } = &proposal.command {
182184
let body = match (&proposal.options.motivation, &proposal.options.summary) {
@@ -191,17 +193,20 @@ impl ExecutableCommand for Network {
191193
continue;
192194
}
193195
};
194-
if let Err(e) = Submitter::from(&self.submission_parameters)
196+
match Submitter::from(&self.submission_parameters)
195197
.propose(
196198
ctx.ic_admin_executor().await?.execution(proposal.clone()),
197199
ForumPostKind::ReplaceNodes { subnet_id: *subnet_id, body },
198200
)
199201
.await
200202
{
201-
errors.push(DetailedError {
202-
proposal: Some(proposal),
203-
error: e,
204-
});
203+
Err(e) => {
204+
errors.push(DetailedError {
205+
proposal: Some(proposal),
206+
error: e,
207+
});
208+
}
209+
Ok(p) => submitted_proposals.push(p),
205210
}
206211
} else {
207212
errors.push(DetailedError {
@@ -211,6 +216,10 @@ impl ExecutableCommand for Network {
211216
}
212217
}
213218

219+
for p in submitted_proposals.iter().flatten() {
220+
println! {"{}", p};
221+
}
222+
214223
if errors.is_empty() {
215224
Ok(())
216225
} else {

rs/cli/src/commands/nodes/remove.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl ExecutableCommand for Remove {
5252
})
5353
.await?;
5454
Submitter::from(&self.submission_parameters)
55-
.propose(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
55+
.propose_and_print(ctx.ic_admin_executor().await?.execution(runner_proposal), ForumPostKind::Generic)
5656
.await
5757
}
5858

rs/cli/src/commands/propose.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl ExecutableCommand for Propose {
4444
let cmd = IcAdminProposal::new(IcAdminProposalCommand::Raw(args.clone()), Default::default());
4545

4646
Submitter::from(&self.submission_parameters)
47-
.propose(ctx.ic_admin_executor().await?.execution(cmd), ForumPostKind::Generic)
47+
.propose_and_print(ctx.ic_admin_executor().await?.execution(cmd), ForumPostKind::Generic)
4848
.await
4949
}
5050

0 commit comments

Comments
 (0)