Skip to content

Add --dry-run and --ignore-no-collector-configured flags to node push commands - #1047

Merged
cgalibern merged 9 commits into
opensvc:mainfrom
PaulJouvanceau:dev
Jun 25, 2026
Merged

Add --dry-run and --ignore-no-collector-configured flags to node push commands#1047
cgalibern merged 9 commits into
opensvc:mainfrom
PaulJouvanceau:dev

Conversation

@PaulJouvanceau

Copy link
Copy Markdown
Contributor

No description provided.

@PaulJouvanceau PaulJouvanceau changed the title feat(node push): add --ignore-no-collector-configured flag Add --dry-run and --ignore-no-collector-configured flags to node push commands Jun 19, 2026

@cgalibern cgalibern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need fix --ignore-no-collector-configured

@cgalibern
cgalibern self-requested a review June 23, 2026 12:27
Comment thread core/object/node.go Outdated
"github.com/opensvc/om3/v3/util/scsi"
)

var ErrCollectorNotConfigured = errors.New("collector is not configured")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is already define: collector.ErrConfig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var (
	ErrConfig       = errors.New("collector is not configured: empty configuration keyword node.dbopensvc")
	ErrUnregistered = errors.New("this node is not registered. try 'om node register'")
)

Add --ignore-no-collector-configured flag to om/ox node push asset,
disk, and pkg commands to silently ignore errors caused by a missing
collector configuration.
Add --dry-run flag to both om and ox node push asset/disk/pkg commands.
When set, the command displays the data that would be pushed without
actually sending it to the collector.

The output is identical to a real run, allowing users to preview
the collected information safely.
Add --ignore-no-collector-configured to om and ox node sysreport commands,
allowing the command to succeed silently when no collector is configured.
Add --ignore-no-collector-configured flag to both om and ox
object push resinfo commands. When set, errors caused by a missing
collector configuration are silently ignored, allowing the command
to succeed or continue with other objects.
Replace string matching with errors.Is for "collector is not
configured" detection, making the --ignore-no-collector-configured
flag robust against message changes.

- Add ErrCollectorNotConfigured sentinel in object package.
- Wrap errors from CollectorFeeder/CollectorFeedClient with %w so all
  push commands (asset, disk, pkg, sysreport, resinfo) benefit.
- Update isNoCollectorError helper in omcmd and oxcmd to use errors.Is.
- Remove redundant %w wrappers in individual push functions.
Make the audit command survive daemon restarts by retrying
the connection, following the same pattern as om daemon events.
Replace the newly introduced ErrCollectorNotConfigured sentinel with
the already defined collector.ErrConfig to avoid duplication.
Update isNoCollectorError helpers to use errors.Is(err, collector.ErrConfig).
Remove the duplicate error variable from the object package.
@cgalibern
cgalibern merged commit c1427fb into opensvc:main Jun 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants