Problem/Motivation

The new Drush 9 version has a complete new way of defining Drush commands. Therefore, all the Drush commands in modules need to be rewritten for Drush 9.

Proposed resolution

- Rewrite the drush commands to the Drush 9 format.
- Implement sensu format and verbode mode for 'run' command.

Remaining tasks

- Rewrite all drush commands to the Drush 9 format.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BryanDeNijs created an issue. See original summary.

BryanDeNijs’s picture

I wrote a patch that ports the Drush commands for Drush 9.

Remaining tasks: support sensu format and verbose mode for the 'run' command.

BryanDeNijs’s picture

Status: Active » Needs work
BryanDeNijs’s picture

Whoops. Typo in the first patch.. Here is a new one.

BryanDeNijs’s picture

Status: Needs work » Needs review
FileSize
749 bytes
13.19 KB

According to the Nagios Developer Guidelines (http://nagios-plugins.org/doc/guidelines.html), exit code 3 means "unknown" and exit code 2 means "critical". This was reversed in the old version of this module.
I don't know if software other than Nagios interprets the exit codes differently, but this patch fixes it for Nagios.

Berdir’s picture

Status: Needs review » Needs work

Needs a reroll.

BryanDeNijs’s picture

Status: Needs work » Needs review
FileSize
12.25 KB

Rerolled onto 8.x-1.x-dev (removed the composer.json file out of the patch)

Berdir’s picture

Status: Needs review » Needs work

Thanks. I think the extra part from composer.json is recommend and should be added back?

Tested this quickly manually. It looks like the sensor argument for monitoring:run is now required, which means we can't run all sensors?

The output argument to monitoring:run also doesn't seem to work, I always get a table.

And, it would be helpful to add aliases for the old commands.

BryanDeNijs’s picture

#8: You're right. I was a bit to fast.
Here is a new patch with the composer.json addition and a fix for the monitoring:run command.

The aliases are already added so they should already work.

About the output and the verbose argument: That's true. It's still a @todo.
I didn't (and don't) have the time to write something for that. I'm sorry. Maybe somebody else can help with that.

EDIT: However, Drush 9 provides a --format argument where you can set an output format (table, csv, html. json, list, var_export, yaml)

--format=json outputs a nice JSON array. Maybe it is not needed to write something new for that :-)

Primsi’s picture

Added an option for the sensu output, but left out the custom output options from before, because as @BryanDeNijs already mentioned, the --format option seems to do a good job.

I added a new option called --sensu-output. I was thinking about providing a new output format for sensu, but it doesn't make much sense for non monitoring output I guess.

I also left the --output option there for now, allowing just "sensu". Not sure if we want that or not.

Regarding the --verbose, I added some logic for that, but couldn't really test properly. The output there seems to be mostly empty.

Berdir’s picture

The problem with --format vs --output is that their output isn't the same, --output=json prints more with different keys and also supports --expand=sensor to add the sensor information as well. I added some hardcoded checks on format not table now, I think with default fields and so on, you could get cleaner results but trying to make it easy to switch from drush 8 to 9.

Verbose is weird, it only works if you combine it with force as the cached results don't have verbose information. Works ok then.

I also removed the truncating of the message for the default table output, looks fairly ok with multi-line messages I think and then you don't miss half the information.

And simplified a few option checks, all defined options are initalized, so we can do with fewer conditions, ?? and so on.

Berdir’s picture

Status: Needs review » Fixed

Committed.

  • Berdir committed a5c6285 on 8.x-1.x authored by BryanDeNijs
    Issue #3054402 by BryanDeNijs, Berdir, Primsi: Drush 9 support
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.