Selector in CLI is ignored #3950
-
Hello, I'm switching from Deployer v6 to v7.4.1. I did follow the official migration guide and ended up with this
When running the command Can somebody point me towards my mistake? On side note, the migration guide does not mention that the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Good point.
I'm not completely getting but your mistake is. Could you please explain and show some examples? |
Beta Was this translation helpful? Give feedback.
-
What's taking so long to find and fix the issue here @antonmedv? It's been more than 2 months since this issue was raised and there's still no fix! The specified selector and Using a simple deploy.php file: set('default_selector', 'type=web');
host('web.example.com')
->setLabels([
'type' => 'web',
'env' => 'prod',
]);
host('db.example.com')
->setLabels([
'type' => 'db',
'env' => 'prod',
]);
task('info', function () {
writeln('type:' . get('labels')['type'] . ' env:' . get('labels')['env']);
}); If you run this command: $ dep info all
task info
[web.example.com] type:web env:prod
$ dep info anythingyoulikehere
task info
[web.example.com] type:web env:prod
$ dep info this_gets_completely_ignored_when_default_selector_is_set
task info
[web.example.com] type:web env:prod The The issue is here: https://github.com/deployphp/deployer/blob/v7.5.8/src/Command/SelectCommand.php#L54 $selector = Deployer::get()->config->get('default_selector', $input->getArgument('selector')); Yes, you're wanting to set a default for something but you're setting the wrong default... This should instead read something like this: $selector = $input->getArgument('selector');
$selector = empty($selector) ? Deployer::get()->config->get('default_selector') : $selector; |
Beta Was this translation helpful? Give feedback.
-
Fixed in v7.5.10 and v8-alpha.1. |
Beta Was this translation helpful? Give feedback.
Fixed in v7.5.10 and v8-alpha.1.