Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-2797

Improve exit code for errors in 'puppetserver ca list'

    XMLWordPrintable

Details

    • Story
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • SERVER 6.7.0
    • SERVER 7.6.1, SERVER 6.19.0
    • Puppet Server
    • OSP puppetserver 6.7.1 with a CA master and 3 compile masters behind a loadbalancer.

    • Bug Fix
    • The `puppetserver ca list` command will now exit 1 when run on a non-CA server.
    • Needs Assessment

    Description

      Use case: I'm working on some scripting to run a puppetserver ca command.  I want to put in a safeguard to prevent someone from running a CA command on a compile master.  The notion I had was to detect the ca-master by looking at the CA.

       

      A CA master runs puppetserver ca list --all just like you would expect.  On the compile masters, though:

       

      # puppetserver ca list --all
      Error:
       code: 403
       body: Forbidden request: /puppet-ca/v1/certificate_statuses/any_key (method :get). Please see the server logs for details.
      No certificates to list
       
      # echo $?
      0
      

       

      Since everything about that query was a failure, I would expect an error code to be returned.  Instead the error is all in the text.  While obvious to a human that this failed, with it having exited 0 we're into grepping text to find that the command failed.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ratnix Greg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support