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

Problem: can't customize flags of cli commands other than start #70

Merged
merged 6 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## UNRELEASED
- [#52](https://github.com/crypto-com/pystarport/pull/52) support jsonnet as config language
- [#56](https://github.com/crypto-com/pystarport/pull/56) Support override config.toml for all validators
- [#]() Add config item `cmd-flags` to supply custom flags for all chain binary commands other than `start`, which is
yihuang marked this conversation as resolved.
Show resolved Hide resolved
handled by existing `start-flags`.

*Feb 18, 2022*

Expand Down
8 changes: 5 additions & 3 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def init(self, i):
def export(self, i=0):
return self.cosmos_cli(i).export()

def validate_genesis(self, i=0):
return self.cosmos_cli(i).validate_genesis()
def validate_genesis(self, i=0, **kwargs):
return self.cosmos_cli(i).validate_genesis(**kwargs)

def add_genesis_account(self, addr, coins, i=0, **kwargs):
return self.cosmos_cli(i).add_genesis_account(addr, coins, **kwargs)
Expand Down Expand Up @@ -728,6 +728,7 @@ def create_account(cli, account, use_ledger=False):
val["moniker"],
chain_id=config["chain_id"],
home=home_dir(data_dir, i),
**config.get("init-flags", {}),
yihuang marked this conversation as resolved.
Show resolved Hide resolved
)
if "consensus_key" in val:
# restore consensus private key
Expand Down Expand Up @@ -809,6 +810,7 @@ def create_account(cli, account, use_ledger=False):
i=i,
min_self_delegation=node.get("min_self_delegation", 1),
pubkey=node.get("pubkey"),
**config.get("init-flags", {}),
yihuang marked this conversation as resolved.
Show resolved Hide resolved
)

# create accounts
Expand Down Expand Up @@ -867,7 +869,7 @@ def create_account(cli, account, use_ledger=False):
# because the new binary may be a breaking one.
doc = tomlkit.parse((data_dir / "node0/config/config.toml").read_text())
if not doc["statesync"]["enable"]:
cli.validate_genesis()
cli.validate_genesis(config.get("init-flags", {}))
yihuang marked this conversation as resolved.
Show resolved Hide resolved

# write supervisord config file
with (data_dir / SUPERVISOR_CONFIG_FILE).open("w") as fp:
Expand Down
4 changes: 2 additions & 2 deletions pystarport/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def init(self, moniker):
home=self.data_dir,
)

def validate_genesis(self):
return self.raw("validate-genesis", home=self.data_dir)
def validate_genesis(self, **kwargs):
return self.raw("validate-genesis", home=self.data_dir, **kwargs)

def add_genesis_account(self, addr, coins, **kwargs):
return self.raw(
Expand Down