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

Improve command usage descriptions (continued from staled #108) #436

Open
com2 opened this issue Jan 27, 2023 · 6 comments
Open

Improve command usage descriptions (continued from staled #108) #436

com2 opened this issue Jan 27, 2023 · 6 comments
Assignees
Labels

Comments

@com2
Copy link

com2 commented Jan 27, 2023

I did not think that commenting would reopen #108 so here another attempt to draw your attention.

hcloud server create-image --help is not clear about the use of --label and it was impossible for me to create a valid command line with that "flag". For instance:

$ hcloud server create-image --type snapshot --label name=upgrade-ready --label ts="$timestamp" --description "upgrade-ready $timestamp" $svrid
hcloud: invalid input in field 'labels' (invalid_input)

I hoped to create a bash script to make things a bit easier but with the lack of documentation it would be better to "stale" not only #108 but also the whole project. It would force some to continue with Python or Go and me to abandon and do it all manually.

@com2
Copy link
Author

com2 commented Jan 27, 2023

apparently labels in hcloud cli does not accept any bash variable. I tried to work around the issue and tried:

$ hcloud image add-label -o $imageID ts=$ts
hcloud: invalid input in field 'labels' (invalid_input)
$ hcloud image add-label -o $imageID ts="$ts"
hcloud: invalid input in field 'labels' (invalid_input)
$ hcloud image add-label -o $imageID "ts=$ts"
hcloud: invalid input in field 'labels' (invalid_input)

Turned out that labels do not accept certain characters. After cleaning up the $ts variable the first line of the example started working. Looks like that server create-image --label for the same reason. I guess that only alphanumerical and underscore is accepted.

@com2
Copy link
Author

com2 commented Jan 27, 2023

In hcloud image enable-protection --help the expected PROTECTIONLEVEL values are not listed.

@apricote
Copy link
Member

apricote commented Feb 6, 2023

Hey @com2, please keep posting any usability issues you find, getting actual feedback and where issues arise is important to us.

For labels in particular, the rules for what is and what is not allowed are documented in our API docs: https://docs.hetzner.cloud/#labels

Labels are key/value pairs that can be attached to all resources.

Valid label keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be a string of 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).

Valid label values must be a string of 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.

The hetzner.cloud/ prefix is reserved and cannot be used.

@apricote apricote self-assigned this Feb 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2023

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label May 7, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2023
@apricote apricote reopened this Jun 6, 2023
@github-actions github-actions bot removed the stale label Jun 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.

@github-actions github-actions bot added the stale label Sep 6, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
@apricote apricote added pinned and removed stale labels Oct 6, 2023
@apricote apricote reopened this Oct 6, 2023
@phm07
Copy link
Contributor

phm07 commented Jul 11, 2024

We already improved the command usage descriptions in #709. They now uniformly comply to the docopt standard.
The error you see comes straight from the API because we currently do not do any validation on labels before sending the request. I agree that the API error is not very helpful in this case. We should probably add custom validation here (and in many other places).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants