Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updatedb --post-updates requires an option argument to run #3385

Closed
rbayliss opened this issue Feb 14, 2018 · 4 comments
Closed

updatedb --post-updates requires an option argument to run #3385

rbayliss opened this issue Feb 14, 2018 · 4 comments

Comments

@rbayliss
Copy link
Contributor

On Drush 9.1.0, drush updatedb --post-updates displays pending post updates, but does not actually execute them. drush updatedb --post-updates=1 does execute them. I'm unclear on whether this is an upstream bug with consolidation/annotated-command or something with drush. If I drop in a debug statement at the top of UpdateDbCommands::updatedb(), I can see the following options values:

// Debug output with drush updatedb --post-updates -y
array (
  // ...
  'post-updates' => NULL,
  'no-post-updates' => false,
  // ... 
)
// Debug output with drush updatedb --post-updates=1 -y
array(
  // ...
  'post-updates' => '1',
  'no-post-updates' => false,
  // ...
)
@rbayliss
Copy link
Contributor Author

For reference, consolidation/annotated-command is at 2.8.2.

@weitzman
Copy link
Member

I can confirm this. Using Drush 9.1, with symfony/console v3.2.14. The spec thats gone wrong here is "If the option exists on the commandline, but has no value (e.g. --foo), then the value will be true" from https://github.com/consolidation/annotated-command/#option-default-values.

To reproduce this, run the command (or sut updatedb --post-updates) above and do a print)r($options) at top of \Drush\Commands\core\UpdateDBCommands::updatedb. You don't actually need any pending updates.

/cc @greg-1-anderson

@greg-1-anderson
Copy link
Member

The unit tests only had coverage for StringInput; I added tests for ArgvInput, and the tests are still passing.

I'll investigate in the context of Drush and see if I can figure out what the cause is here.

@greg-1-anderson
Copy link
Member

The problem is that DrushArgvInput extends Input, and it needs to extend ArgvInput for all of the features of AnnotatedCommand to work. I'll submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants