The reason why i do this is i accidently write crappy codes inside #pre_upgrade function
So pre_upgrade will definite trap when ugrading canister.
I have read ic-manage-canister api doc on install_code
api .
And i find out some ways to might achive goal:
method1:
Can i do something like that above to skip_pre_upgrade?
I dont know the correct syntax
btwl@btwl-virtual-machine ~/c/i/tax_lint (master) [2]>
dfx canister install backend --mode upgrade --argument 'skip_pre_upgrade=true'
error: a value is required for '--mode <MODE>' but none was supplied
[possible values: install, reinstall, upgrade, auto]
For more information, try '--help'.
method2:
using rust lib of ic-agent-rs and ic-utils
method3:
using management canister api from dfx
something might look like : but i dont quite know the syntax
dfx canister \
--ic \
call aaaaa-aa install_code\
'(record {
canister_id = principal "v7g7o-oiaaa-aaaag-qcj3q-cai";
mode = variant { upgrade = opt record { skip_pre_upgrade = opt true} };
wasm_module = /home/btwl/code/ic/tax_lint/target/wasm32-unknown-unknown/release/backend.wasm;
arg = "???"
})'\
--wallet $(dfx identity --ic get-wallet) \
--candid /home/btwl/code/ic/tax_lint/backend/canisters/backend/my_tests/test_in_cmd/dfx_calls/manage_can.did
method4
motoko also a try