1
0
Fork 0
mirror of synced 2024-05-27 20:41:12 -04:00

Fix interaction between --only and defaults

We should treat defaults specially, and even when `--only` is
specified, we should always run defaults.
This commit is contained in:
Anish Athalye 2020-11-22 16:58:00 -05:00
parent 5294594f5a
commit cf366bbf66
3 changed files with 24 additions and 3 deletions

View file

@ -22,8 +22,9 @@ class Dispatcher(object):
success = True
for task in tasks:
for action in task:
if self._only is not None and action not in self._only \
or self._skip is not None and action in self._skip:
if (self._only is not None and action not in self._only \
or self._skip is not None and action in self._skip) \
and action != 'defaults':
self._log.info('Skipping action %s' % action)
continue
handled = False

1
test/Vagrantfile vendored
View file

@ -1,7 +1,6 @@
Vagrant.configure(2) do |config|
config.vm.box = 'ubuntu/bionic64'
# sync by copying for isolation
config.vm.synced_folder "..", "/dotbot", mount_options: ["ro"]
# disable default synced folder

View file

@ -0,0 +1,21 @@
test_description='--only does not skip defaults'
. '../test-lib.bash'
test_expect_success 'setup' '
echo "apple" > ${DOTFILES}/x
'
test_expect_success 'run' '
run_dotbot --only link <<EOF
- defaults:
link:
create: true
- shell:
- echo "pear" > ~/z
- link:
~/d/x: x
'
test_expect_success 'test' '
grep "apple" ~/d/x && ! test -f ~/z
'