Skip to content

--file silently overrides a mismatched object name with the positional argument #267

Description

@tas50

When create or edit is given --file, most nouns overwrite the name in the file with the name on the command line, without saying so:

  • node (apps/cinc/cmd/node.go, create and edit)
  • role (role.go, create and edit)
  • environment (environment.go, create and edit)
  • client, user, group, org and keys edit

So cinc role edit web --file db.json, where db.json holds the db role, writes db's run list and attributes over web. The user most likely passed the wrong file, and nothing warns them.

Data bags already refuse this (#264). A --file item id that differs from the positional id is rejected before anything is sent, with an error naming both. The other nouns should do the same: refuse when the file names a different object, and accept a file with no name or the same name.

Update the unit tests and integration cases that currently rely on the override.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions