Skip to content

Enable DEBUG mode for preview is not working #4211

@tjarbo

Description

@tjarbo

Describe the bug
While trying to the run the preview command with the --debug flag, DNSControl prints the version number and does not perform the expected verbose preview run.

To Reproduce
Steps to reproduce the behavior:

  1. Use the container image
  2. Run the following commands:
➜  folder-name git:(main) ✗ docker run --rm -it -v "$(pwd):/dns:z" ghcr.io/stackexchange/dnscontrol                        
NAME:
   dnscontrol - DNSControl is a compiler and DSL for managing dns zones

USAGE:
   dnscontrol [global options] [command [command options]]

VERSION:
   DNSControl version 4.36.1

COMMANDS:
   help, h  Shows a list of commands or help for one command

   main:
     preview  read live configuration and identify changes to be made, without applying them
     push     identify changes to be made, and perform them

   debug:
     check     Check and validate dnsconfig.js. Output to stdout.  Do not access providers.
     print-ir  Output intermediate representation (IR) after running validation and normalization logic.
     version   Print version information

   utility:
     check-creds          Do a small operation to verify credentials (stand-alone)
     create-domains       DEPRECATED: Ensures that all domains in your configuration are activated at their Domain Service Provider (This does not purchase the domain or otherwise interact with Registrars.)
     fmt                  [BETA] Format and prettify a given file
     get-zones, get-zone  gets a zone from a provider (stand-alone)
     shell-completion     generate shell completion scripts
     write-types          [BETA] Write a TypeScript declaration file in the current directory

GLOBAL OPTIONS:
   --debug, -v        Enable debug logging
   --allow-fetch      Enable JS fetch(), dangerous on untrusted code!
   --disableordering  Disables update reordering
   --no-colors        Disable colors
   --help, -h         show help
   --version, -v      print the version
➜  folder-name git:(main) ✗ docker run --rm -it -v "$(pwd):/dns:z" ghcr.io/stackexchange/dnscontrol --debug preview
dnscontrol version DNSControl version 4.36.1
➜  folder-name git:(main) ✗ docker run --rm -it -v "$(pwd):/dns:z" ghcr.io/stackexchange/dnscontrol -v preview     
dnscontrol version DNSControl version 4.36.1
➜  folder-name git:(main) ✗ docker run --rm -it -v "$(pwd):/dns:z" ghcr.io/stackexchange/dnscontrol preview   
CONCURRENTLY checking for 1 zone(s)
SERIALLY checking for 0 zone(s)
Waiting for concurrent checking(s) to complete...DONE
[...]

Expected behavior
A normal preview run with more details.

Additional context
The document https://github.com/DNSControl/dnscontrol/blob/main/documentation/commands/globalflags.md describes, that the --debug flag has to be placed before the preview command.
As visible in the help menu of the first command, --debug and --version share the same alias -v.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions