Selector in CLI is ignored #3950
Replies: 2 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.
-
Hello,
I'm switching from Deployer v6 to v7.4.1. I did follow the official migration guide and ended up with this
deploy.php
:When running the command
php deployer.phar deploy stage=production
it deploys to the staging host.If I set the
default_selector
to a non-existing value likeabcd
and run the same command again, i do get the errorNo host selected. Please, check your selector: stage=abcd
(as expected). So I do assume that my host definitions are correct (deploying to staging is working fine).Can somebody point me towards my mistake?
On side note, the migration guide does not mention that the
RuntimeException
was renamed toRunException
. I do think that this should be included in the guide, at least it took me some time to figure it out on my own.Beta Was this translation helpful? Give feedback.
All reactions