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

go/control: Show the debug option statuses in the control output #4634

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .changelog/4634.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/control: Show the debug option statuses in the control output
15 changes: 15 additions & 0 deletions go/control/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ type Status struct {
// SoftwareVersion is the oasis-node software version.
SoftwareVersion string `json:"software_version"`

// Debug is the oasis-node debug status.
Debug *DebugStatus `json:"debug,omitempty"`

// Identity is the identity of the node.
Identity IdentityStatus `json:"identity"`

Expand All @@ -74,6 +77,18 @@ type Status struct {
PendingUpgrades []*upgrade.PendingUpgrade `json:"pending_upgrades"`
}

// DebugStatus is the current node debug status, listing the various node
// debug options if enabled.
type DebugStatus struct {
// Enabled is true iff the node is running with DebugDontBlameOasis
// set.
Enabled bool `json:"enabled"`

// AllowRoot is true iff the node is running with DebugAllowRoot
// set.
AllowRoot bool `json:"allow_root"`
}

// IdentityStatus is the current node identity status, listing all the public keys that identify
// this node in different contexts.
type IdentityStatus struct {
Expand Down
10 changes: 10 additions & 0 deletions go/control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/oasisprotocol/oasis-core/go/common/version"
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
control "github.com/oasisprotocol/oasis-core/go/control/api"
cmdFlags "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/flags"
upgrade "github.com/oasisprotocol/oasis-core/go/upgrade/api"
)

Expand Down Expand Up @@ -104,8 +105,17 @@ func (c *nodeController) GetStatus(ctx context.Context) (*control.Status, error)

ident := c.node.GetIdentity()

var ds *control.DebugStatus
if debugEnabled := cmdFlags.DebugDontBlameOasis(); debugEnabled {
ds = &control.DebugStatus{
Enabled: debugEnabled,
AllowRoot: cmdFlags.DebugAllowRoot(),
}
}

return &control.Status{
SoftwareVersion: version.SoftwareVersion,
Debug: ds,
Identity: control.IdentityStatus{
Node: ident.NodeSigner.Public(),
P2P: ident.P2PSigner.Public(),
Expand Down