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:
parent
5294594f5a
commit
cf366bbf66
3 changed files with 24 additions and 3 deletions
|
@ -22,8 +22,9 @@ class Dispatcher(object):
|
||||||
success = True
|
success = True
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
for action in task:
|
for action in task:
|
||||||
if self._only is not None and action not in self._only \
|
if (self._only is not None and action not in self._only \
|
||||||
or self._skip is not None and action in self._skip:
|
or self._skip is not None and action in self._skip) \
|
||||||
|
and action != 'defaults':
|
||||||
self._log.info('Skipping action %s' % action)
|
self._log.info('Skipping action %s' % action)
|
||||||
continue
|
continue
|
||||||
handled = False
|
handled = False
|
||||||
|
|
1
test/Vagrantfile
vendored
1
test/Vagrantfile
vendored
|
@ -1,7 +1,6 @@
|
||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
config.vm.box = 'ubuntu/bionic64'
|
config.vm.box = 'ubuntu/bionic64'
|
||||||
|
|
||||||
# sync by copying for isolation
|
|
||||||
config.vm.synced_folder "..", "/dotbot", mount_options: ["ro"]
|
config.vm.synced_folder "..", "/dotbot", mount_options: ["ro"]
|
||||||
|
|
||||||
# disable default synced folder
|
# disable default synced folder
|
||||||
|
|
21
test/tests/only-defaults.bash
Normal file
21
test/tests/only-defaults.bash
Normal 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
|
||||||
|
'
|
Loading…
Reference in a new issue