Restart policy name discrepancy in `flyctl help`

I just spotted a possible discrepancy for the “on-failure” restart mode. If I get info about a machine using the RESTful API, I get this:

    [config] => Array
        (
            [init] => Array
                (
                )

            [guest] => Array
                (
                    [cpu_kind] => shared
                    [cpus] => 1
                    [memory_mb] => 256
                )

            [image] => registry.fly.io/sequoia-browser-test:small@sha256:xxx
            [restart] => Array
                (
                    [policy] => on-failure
                    [max_retries] => 10
                )

            [dns] => Array
                (
                )

        )

The restart key matches the docs:

restart: Defines whether and how flyd restarts a Machine after its main process exits. Learn more about Machine restart policies. This object has the following options:

  • policy: string - Required. One of “no”, “on-failure”, or “always”.
  • max_retries: int (nil) - The maximum number of retries when the policy is “on-failure”.

However, if I do flyctl machine create --help, I get (in part) this:

--restart string     Set the restart policy for a Machine. Options include 'no', 'always', and
                     'on-fail'.
                     Default is 'on-fail' for Machines created by 'fly deploy' and Machines with
                     a schedule. Default is 'always' for Machines created by 'fly m run'.

I wonder if this help text is incorrect, and this should be on-failure. It’s the same for flyctl machine update too.

Ah! Not a bug. From the docs:

Important: The API and the returned Machine config use on-failure instead of on-fail.

Bonus observation:

In the previously linked doc, the restart policy at the top of the docs is said to be no, always, or on-fail. But at the end, the TOML options are <never | always | on-failure>; is the no/never discrepancy also deliberate?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.