Uploaded image for project: 'Trapperkeeper'
  1. Trapperkeeper
  2. TK-467

TrapperKeeper CLI entrypoint responds to --help by throwing an exception

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • TK 1.5.6
    • TK 3.1.0
    • TrapperKeeper
    • None
    • Needs Assessment

    Description

      When the --help flag is Passed to the foreground command of a TrapperKeeper service, an error message is raised that contains a formatted help string. This is dumped unceremoniously to STDERR instead of being printed nicely to STDOUT.

      Reproduction Case

      • Install Puppet Server 5.3.0 on CentOS 7:

      rpm -Uvh http://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
      yum install -y puppetserver
      

      • Invoke puppetserver foreground with the --help flag:

      /opt/puppetlabs/server/bin/puppetserver foreground --help
      

      Outcome

      The help text is barfed to STDERR as part of a stacktrace:

      # /opt/puppetlabs/server/bin/puppetserver foreground --help
       
      20:24:12.129 [main] DEBUG puppetlabs.trapperkeeper.core - Finished TK main lifecycle, shutting down Clojure agent threads.
      Exception in thread "main" clojure.lang.ExceptionInfo: throw+: {:kind :puppetlabs.kitchensink.core/cli-help, :msg "  -d, --debug                                   Turns on debug mode\n  -b, --bootstrap-config BOOTSTRAP-CONFIG-FILE  Path to bootstrap config file\n  -c, --config CONFIG-PATH                      Path to a configuration file or directory of configuration files, or a comma-separated list of such paths. See the documentation for a list of supported file types.\n  -p, --plugins PLUGINS-DIRECTORY               Path to directory plugin .jars\n  -r, --restart-file RESTART-FILE               Path to a file whose contents are incremented each time all of the configured services have been started.\n  -h, --help                                    Show help"} {:kind :puppetlabs.kitchensink.core/cli-help, :msg "  -d, --debug                                   Turns on debug mode\n  -b, --bootstrap-config BOOTSTRAP-CONFIG-FILE  Path to bootstrap config file\n  -c, --config CONFIG-PATH                      Path to a configuration file or directory of configuration files, or a comma-separated list of such paths. See the documentation for a list of supported file types.\n  -p, --plugins PLUGINS-DIRECTORY               Path to directory plugin .jars\n  -r, --restart-file RESTART-FILE               Path to a file whose contents are incremented each time all of the configured services have been started.\n  -h, --help                                    Show help"}
      	at slingshot.support$stack_trace.invoke(support.clj:201)
      	at puppetlabs.kitchensink.core$cli_BANG_.invokeStatic(core.clj:878)
      	at puppetlabs.kitchensink.core$cli_BANG_.invoke(core.clj:840)
      	at puppetlabs.trapperkeeper.internal$eval13808$parse_cli_args_BANG___13813$fn__13814.invoke(internal.clj:179)
      	at puppetlabs.trapperkeeper.internal$eval13808$parse_cli_args_BANG___13813.invoke(internal.clj:162)
      	at puppetlabs.trapperkeeper.core$main.invokeStatic(core.clj:173)
      	at puppetlabs.trapperkeeper.core$main.doInvoke(core.clj:160)
      	at clojure.lang.RestFn.invoke(RestFn.java:551)
      	at clojure.lang.Var.invoke(Var.java:419)
      	at clojure.lang.AFn.applyToHelper(AFn.java:186)
      	at clojure.lang.Var.applyTo(Var.java:700)
      	at clojure.core$apply.invokeStatic(core.clj:646)
      	at clojure.core$apply.invoke(core.clj:641)
      	at puppetlabs.trapperkeeper.main$_main.invokeStatic(main.clj:7)
      	at puppetlabs.trapperkeeper.main$_main.doInvoke(main.clj:4)
      	at clojure.lang.RestFn.invoke(RestFn.java:551)
      	at clojure.lang.Var.invoke(Var.java:419)
      	at clojure.lang.AFn.applyToHelper(AFn.java:186)
      	at clojure.lang.Var.applyTo(Var.java:700)
      	at clojure.core$apply.invokeStatic(core.clj:646)
      	at clojure.main$main_opt.invokeStatic(main.clj:314)
      	at clojure.main$main_opt.invoke(main.clj:310)
      	at clojure.main$main.invokeStatic(main.clj:421)
      	at clojure.main$main.doInvoke(main.clj:384)
      	at clojure.lang.RestFn.invoke(RestFn.java:703)
      	at clojure.lang.Var.invoke(Var.java:442)
      	at clojure.lang.AFn.applyToHelper(AFn.java:205)
      	at clojure.lang.Var.applyTo(Var.java:700)
      	at clojure.main.main(main.java:37)
      

      Expected Outcome

      Help should be printed to STDOUT, nicely formatted:

      # /opt/puppetlabs/server/bin/puppetserver foreground --help 2>/dev/null
       
        -d, --debug                                   Turns on debug mode
        -b, --bootstrap-config BOOTSTRAP-CONFIG-FILE  Path to bootstrap config file
        -c, --config CONFIG-PATH                      Path to a configuration file or directory of configuration files, or a comma-separated list of such paths. See the documentation for a list of supported file types.
        -p, --plugins PLUGINS-DIRECTORY               Path to directory plugin .jars
        -r, --restart-file RESTART-FILE               Path to a file whose contents are incremented each time all of the configured services have been started.
        -h, --help                                    Show help
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chuck Charlie Sharpsteen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support