Project

General

Profile

Actions

Feature #6393

closed

Mcollective puppetrun should check status before attempting to run

Added by Trey Dockendorf almost 10 years ago. Updated over 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Puppet
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

I ran into an issue where executing a Puppet run from the web interface that uses mcollective resulted in a not-so-obvious error that was a result of the puppet agent performing a normal run on the client.

D, [2014-06-25T14:46:05.462261 #3440] DEBUG -- : about to execute: /usr/bin/sudo -u foreman-proxy /usr/bin/mco puppet runonce -I <HOST>
W, [2014-06-25T14:46:07.200321 #3440]  WARN -- : Non-null exit code when executing '/usr/bin/sudo-uforeman-proxy/usr/bin/mcopuppetrunonce-I<HOST>'
E, [2014-06-25T14:46:07.203433 #3440] ERROR -- : Failed puppet run: Check Log files

Running again a few seconds later succeeded. The failure was due to the agent applying the catalog, so the mco puppet command failed.

Checking the status could be done by a means such as :

Agent not applying:

$ mco rpc puppet --json status -I <HOST>
[
  {
    "action": "status",
    "sender": "<HOST>",
    "data": {
      "applying": false,
      "status": "stopped",
      "lastrun": 1403725979,
      "idling": false,
      "since_lastrun": 350,
      "message": "Currently stopped; last completed run 5 minutes 50 seconds ago",
      "daemon_present": false,
      "enabled": true,
      "disable_message": "" 
    },
    "statuscode": 0,
    "statusmsg": "OK",
    "agent": "puppet" 
  }
]

Agent applying:
$ mco rpc puppet --json status -I <HOST>

[
  {
    "action": "status",
    "sender": "brazos-wiki.brazos.tamu.edu",
    "data": {
      "applying": true,
      "status": "applying a catalog",
      "lastrun": 1403725979,
      "idling": false,
      "since_lastrun": 454,
      "message": "Currently applying a catalog; last completed run 7 minutes 34 seconds ago",
      "daemon_present": false,
      "enabled": true,
      "disable_message": "" 
    },
    "statuscode": 0,
    "statusmsg": "OK",
    "agent": "puppet" 
  }
]

That output could be very useful to ensuring a Puppet run from the smart-proxy is possible. The same JSON output could be useful when checking for success during the actual 'runonce' command.

Actions #1

Updated by Dominic Cleal almost 10 years ago

  • Category set to Puppet
Actions #2

Updated by Ewoud Kohl van Wijngaarden over 2 years ago

  • Status changed from New to Rejected

The mcollective support has been dropped.

Actions

Also available in: Atom PDF