Usability issues when registering an agent via command line
-
Fix the stork-agent --help
usage text to show/etc/stork/agent.env
as default for env-file.--env-file= Environment file location; applicable only if the use-env-file is provided (default: /etc/stork/server.env)
-
stork-agent
andstork-server
should use the default env files as the help usage text suggests.This should apply to
stork-agent register
as well. It should be possible to run it simply like this:$ stork-agent register FATA[2024-06-19 11:55:35] main.go:197 Problem parsing agent host: address localhost: missing port in address
Currently, env files are not used unless explicitly pointed towards.
I suspect the intention was to describe the behavior of stork daemons when running under service managers, but in that case, the help displayed by the binary shouldn't say there is a default.
-
Fix the ARM example under this section saying that you can register by just specifying the -u
flag. If the previous point of allowing to register without any flags is implemented, the-u
should probably just be removed.This is not the case as you can see. The same error is displayed rather trying to suggest that
-a
is missing:$ stork-agent register -u http://127.0.0.1:8080 FATA[2024-06-19 11:53:40] main.go:197 Problem parsing agent host: address localhost: missing port in address
-
Make the values accepted by -a
and-u
consistent in format.Adding a
-a
with the same value as the-u
as shown in the ARM presents a new error:$ stork-agent register -a http://127.0.0.1:8888 -u http://127.0.0.1:8080 FATA[2024-06-19 11:53:47] main.go:197 Problem parsing agent host: address http://127.0.0.1:8888: too many colons in address
Through trial and error, you are able to determine that
-a
does not like the protocl part. This one works:$ stork-agent register -a 127.0.0.1:8888 -u http://127.0.0.1:8080
But if you try to remove the protocol part from
-u
, it fails again.$ stork-agent register -a 127.0.0.1:8888 -u 127.0.0.1:8080 ERRO[2024-06-19 11:54:25] register.go:376 Cannot parse server URL: 127.0.0.1:8080 error="parse \"127.0.0.1:8080\": first path segment in URL cannot contain colon" FATA[2024-06-19 11:54:25] main.go:217 Registration failed
-
Remove -a
and-u
and replace them with the already existing flags--host
,--port
,--server-url
which are not used. This makes the previous point.In fact,
--server-url
is displayed twice in the help usage text: once under general info and once under register-specific commands.The command would then look like this:
$ stork-agent register --host=127.0.0.1 --port=8080 --server-url 127.0.0.1:8080
-
Have a way to stork-agent register
non-interactively.This appeared as a requirement in the check-pkgs job, but may also be useful for someone who may want to automate registration. While registration is possible without a token, the command line requires interactive input under
>>>> Server access token (optional):
so a script would just block. You cannot bypass it with piping or redirecting a newline to it because you are met with aninappropriate ioctl device
error. Using-t
with an empty value doesn't work either.