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

feat(rust): support node create first argument as inline configuration #8582

Merged

Conversation

adrianbenavides
Copy link
Member

@adrianbenavides adrianbenavides commented Oct 29, 2024

Now we can use the node create positional argument to pass an inline configuration. So, the following are equivalents:

ockam node create "{name: n1}"
ockam node create --configuration "{name: n1}"

@adrianbenavides adrianbenavides requested a review from a team as a code owner October 29, 2024 09:17
@adrianbenavides adrianbenavides marked this pull request as draft October 29, 2024 09:23
@adrianbenavides adrianbenavides force-pushed the adrian/node-create-first-argument-as-inline-config branch from d91208c to 88c7a4c Compare October 29, 2024 17:55
@adrianbenavides adrianbenavides marked this pull request as ready for review October 29, 2024 17:55
@adrianbenavides adrianbenavides force-pushed the adrian/node-create-first-argument-as-inline-config branch from 88c7a4c to b27d3ff Compare October 30, 2024 06:45
etorreborre
etorreborre previously approved these changes Oct 30, 2024
Copy link
Member

@etorreborre etorreborre left a comment

Choose a reason for hiding this comment

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

Approved but I am not a big fan of this because this prevents us from giving precise error messages. For example an incorrect input could be a malformed path but also a configuration file having inlet: instead of tcp-inlet and we can't tell the difference in terms of error.

I would be more comfortable if we could:

  1. Determine for sure what was the intent of the user.
  2. Display an appropriate message saying: "incorrect name" or "incorrect URL", or ... And giving as info we can on why it's incorrect and how to fix it.

Overall I think it is better to reduce the ambiguity in the user intent for command line arguments, at the expense of verbosity. For example what happens if I enter a file name for a local file test-config that does not exist because I made a typo in my file name? Are we going to determine that this is not a file name, thus it must be a node name, and going to silently create a node with that name?

@adrianbenavides
Copy link
Member Author

Approved but I am not a big fan of this because this prevents us from giving precise error messages. For example an incorrect input could be a malformed path but also a configuration file having inlet: instead of tcp-inlet and we can't tell the difference in terms of error.

I don't like it either, but we have to be consistent for now. If the user can run ockam create ./config.yaml I wouldn't understand as a user why I can't just run ockam create "{name: n1, ...}". I think we are still inconsistent with the behavior of the --configuration argument.

The node create positional argument (the current name) is slowly being replaced in importance by the configuration. Perhaps in the near future it would make more sense to have an argument for the name, and leave the positional argument for the configuration alone. But right now I think that's not clear and it's best to have more flexibility in the arguments to see what works best.

@adrianbenavides adrianbenavides added this pull request to the merge queue Oct 30, 2024
Merged via the queue into develop with commit 34da6e1 Oct 30, 2024
31 checks passed
@adrianbenavides adrianbenavides deleted the adrian/node-create-first-argument-as-inline-config branch October 30, 2024 15:31
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