feat: add dfx canister set-controller subcommand#1057
Conversation
|
seeing same failure as PR 1056 when trying to enter nix-shell for e2e tests |
|
Was this discussed as a possibility? instead of Compare to |
This format: was how it was originally when I demo'd the command in the meeting. But the feedback was that explicitly specifying Adding I don't see a clap option to allow both |
lsgunnlsgunn
left a comment
There was a problem hiding this comment.
LGTM-minor suggestion
|
though it was a suggestion during the demo of this command, adding the long form for the arguments i.e. |
|
Not sure if I understand your question ... are you suggesting to use this form to be consistent: |
I'm deferring to your judgement! I can see why the long-form is helpful but also can be verbose. Ideally i'd like to enable both, but it seems to be a limitation of the clap library we use |
|
@lsgunnlsgunn talked with Hans, we're going with the short form and I updated the description to reflect that |
This adds the `dfx canister set-controller` subcommand
```
➜ hello git:(master) dfx canister set-controller --help
dfx-canister-set-controller
Sets the provided identity's name or its principal as the new controller of a canister on the Internet Computer network.
USAGE:
dfx canister set-controller <canister> <new-controller>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<canister> Specifies the canister name or the canister identifier for the canister to be controlled.
<new-controller> Specifies the identity name or the principal of the new controller.
```
An example use case:
```
➜ hello git:(master) dfx identity whoami
default
➜ hello git:(master) dfx identity list
default *
prithvi
➜ hello git:(master) dfx canister create hello
Creating canister "hello"...
"hello" canister created with canister id: "75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q"
➜ hello git:(master) dfx build hello
Building canisters...
➜ hello git:(master)
➜ hello git:(master) dfx canister set-controller hello prithvi
Set "prithvi" as controller of "hello".
➜ hello git:(master)
➜ hello git:(master) dfx canister install hello
Installing code for canister hello, with canister_id 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q
Replica error (code 5): IC0512: Only the controller of canister 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q can control it.
Expected controller: jxpuf-o4cfi-2zfqa-3svif-yxdiz-tuj3p-ctl6m-qsrfv-7zctw-z3bwc-2ae
Actual controller: 5gg4n-o6ooe-5zmlh-ac2kx-ntmkd-kamti-a3rqe-okecn-knil3-ord3t-mae
```
Note: Waiting for #1056 to get merged first (therefore, creating a PR against that branch)
- [x] push local e2e tests which is blocked because of #1057 (comment)
- [ ] update to a replica version which doesn't expose the expected controller's principal
- [x] update to agent-rs after this is merged dfinity/agent-rs#51
## Changelog for advisory-db: Branch: main Commits: [rustsec/advisory-db@653bd139...f2e3a650](rustsec/advisory-db@653bd13...f2e3a65) * [`a44ad8fa`](rustsec/advisory-db@a44ad8f) Clarify meaning of RUSTSEC-2021-0077.md ([RustSec/advisory-db#1061](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1061)) * [`9cc82e1b`](rustsec/advisory-db@9cc82e1) arrow BinaryArray advisory ([RustSec/advisory-db#1057](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1057)) * [`a7d4ec8d`](rustsec/advisory-db@a7d4ec8) Assigned RUSTSEC-2021-0116 to arrow ([RustSec/advisory-db#1062](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1062)) * [`edfbe64d`](rustsec/advisory-db@edfbe64) arrow DecimalArray advisory ([RustSec/advisory-db#1058](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1058)) * [`a9bf4727`](rustsec/advisory-db@a9bf472) Assigned RUSTSEC-2021-0117 to arrow ([RustSec/advisory-db#1063](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1063)) * [`f2e3a650`](rustsec/advisory-db@f2e3a65) Yet another arrow advisory ([RustSec/advisory-db#1059](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1059))
## Changelog for advisory-db: Branch: main Commits: [rustsec/advisory-db@653bd139...f2e3a650](rustsec/advisory-db@653bd13...f2e3a65) * [`a44ad8fa`](rustsec/advisory-db@a44ad8f) Clarify meaning of RUSTSEC-2021-0077.md ([RustSec/advisory-db#1061](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1061)) * [`9cc82e1b`](rustsec/advisory-db@9cc82e1) arrow BinaryArray advisory ([RustSec/advisory-db#1057](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1057)) * [`a7d4ec8d`](rustsec/advisory-db@a7d4ec8) Assigned RUSTSEC-2021-0116 to arrow ([RustSec/advisory-db#1062](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1062)) * [`edfbe64d`](rustsec/advisory-db@edfbe64) arrow DecimalArray advisory ([RustSec/advisory-db#1058](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1058)) * [`a9bf4727`](rustsec/advisory-db@a9bf472) Assigned RUSTSEC-2021-0117 to arrow ([RustSec/advisory-db#1063](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1063)) * [`f2e3a650`](rustsec/advisory-db@f2e3a65) Yet another arrow advisory ([RustSec/advisory-db#1059](http://r.duckduckgo.com/l/?uddg=https://github.com/RustSec/advisory-db/issues/1059))
This adds the
dfx canister set-controllersubcommandAn example use case:
Note: Waiting for #1056 to get merged first (therefore, creating a PR against that branch)