Action

  1. Install/update drush to latest stable version 9
  2. Install module using composer
  3. Enable module using drush
  4. Execute command drush inspect_config --only-error

Observed result

Command returns error message :

  • Command "inspect_config" is not defined.

Command for Drush 8 was brought by https://www.drupal.org/project/config_inspector/issues/2913793

Expected result

  • Now we should handle Drush 9 support
  • Validating schema of config files from Drush command is very useful for CI integration

Todo

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidferlay created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
FileSize
4.18 KB

Basic implementation, provides config:inspect with inspect_config alias command
Needs to decide
- should it provide non-zero exit-code when there's troubles
- decide on command name - I like "config:inspect" but old command using outdated underscore "inspect_config"

davidferlay’s picture

@andypost

  1. Non-zero exit-code will definitly be useful for CI job to fail
  2. config:inspect looks good to me !
davidferlay’s picture

I tested your patch @Andypost (#2) and it seems to work just great !

/var/www/html $ drush config:inspect --help
Inspect config for schema errors.

Examples:
  drush config:inspect          Inspect whole config for schema errors.                    
  drush config:inspect --detail Inspect whole config for schema errors but details errors. 

Arguments:
  [key] (Optional) Configuration key. 

Options:
  --only-error            Display only errors.                                                                                     
  --detail                Show detailed errors.                                                                                    
  --skip-keys[=SKIP-KEYS] Configuration keys to skip.                                                                              
  --format=FORMAT         Format the result data. Available formats:                                                               
                          csv,json,list,null,php,print-r,sections,string,table,tsv,var_dump,var_export,xml,yaml [default: "table"] 
  --fields=FIELDS         Available fields: Key (key), Status (status) [default: "key,status"]                                     
  --field=FIELD           Select just one field, and force format to 'string'.                                                     

Topics:
  drush topic docs:output-formats-filters Output formatters and filters: how to control the output produced by Drush commands 

Aliases: inspect_config
/var/www/html $ drush config:inspect --only-error
 ----- -------- 
  Key   Status  
 ----- -------- 
/srv $ drush en config_inspector
 [success] Successfully enabled: config_inspector

/srv $ drush config:inspect --detail --only-error
 ------------------------------ ---------------- 
  Key                            Status          
 ------------------------------ ---------------- 
  automated_cron.settings:data   missing schema  
 ------------------------------ ---------------- 

I think it would be great though to make it fully silent when no error, to avoid verbose in CI logs.
What do you think ?

andypost’s picture

FileSize
1.67 KB
4.31 KB

Fix codestyle & add exit code
As I see it's common for drush commands to return empty header always (for ex. drush watchdog:show) so did not change

andypost’s picture

FileSize
599 bytes
4.44 KB

One more example of usage

andypost’s picture

FileSize
433 bytes
4.44 KB

last bit of clean-up

davidferlay’s picture

@andypost, you are right, empty header is common accross drush commands

Fortunately --format=string option is useful to only print result without header
For readers, it's possible to print only errors list without any header usingdrush config:inspect --only-error --format=string

Btw, I tested last patch from #7 and it seems working all fine !

davidferlay’s picture

Status: Needs review » Reviewed & tested by the community
piggito’s picture

FileSize
4.61 KB

a port of patch at #7 for drush 9.5 compatibility

piggito’s picture

FileSize
1.79 KB
vuil’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

  • ilchovuchkov committed 25b9868 on 8.x-1.x
    Issue #3047418 by ilchovuchkov, andypost, piggito, davidferlay: Drush 9...
vuil’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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

vuil’s picture

vuil’s picture

Status: Closed (fixed) » Needs work

I revert the issue to Needs work as @andypost comment here.

vuil’s picture

Status: Needs work » Needs review
FileSize
9.97 KB

Upload a patch which is dependent to that issue.

  • ilchovuchkov committed 3c713d5 on 8.x-1.x
    Issue #3047418 by ilchovuchkov: Add config_inspector.drush.inc
    
vuil’s picture

Status: Needs review » Needs work

The issue still Needs work.

vuil’s picture

vuil’s picture

Gábor Hojtsy’s picture

What needs work here? The Drush 9 commands are added. I don't understand why was the drush.inc added? That is certainly not for Drush 9.

andypost’s picture

Status: Needs work » Needs review
FileSize
737 bytes

It just needs to add drush 10 support

PS: added sniffers run, looks it needs follow-up to remove simpletest from drupalci.yml and polish remains

andypost’s picture

FileSize
1.05 KB

It just needs to remove few lines as there only 2 functional tests

andypost’s picture

Title: Drush 9 command support » Drush 10 command support

as 10 is current version also it needs to remove `core: 8.x` from info file

Gábor Hojtsy’s picture

Why does this module need a drupalci.yml file in the first place? What do we need to customize?

vuil’s picture

Status: Needs review » Reviewed & tested by the community

  • vuil committed fc116ba on 8.x-1.x authored by andypost
    Issue #3047418 by andypost, piggito, vuil, davidferlay: Drush 10 command...
vuil’s picture

Status: Reviewed & tested by the community » Fixed
andypost’s picture

@Gabor it just optimize defaults

Status: Fixed » Closed (fixed)

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