Skip to content

Commit

Permalink
Fix bash-completion for Debian packages.
Browse files Browse the repository at this point in the history
The file containing the completions was installed in the wrong directory
(/usr/share/bash_completions/completions instead of
/usr/share/bash_completion/completions) and symbolic links for
salt-call, salt-cp, and salt-key were missing.
  • Loading branch information
smarsching committed Aug 22, 2024
1 parent a763096 commit be4bfbe
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/66560.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed bash-completion in Debian / Ubuntu packages.
2 changes: 1 addition & 1 deletion pkg/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DH_VERBOSE = 1
.PHONY: override_dh_strip

%:
dh $@
dh $@ --with=bash_completion

# dh_auto_clean tries to invoke distutils causing failures.
override_dh_auto_clean:
Expand Down
1 change: 1 addition & 0 deletions pkg/debian/salt-common.bash-completion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg/common/salt.bash salt
1 change: 0 additions & 1 deletion pkg/debian/salt-common.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pkg/common/fish-completions/salt-cp.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-call.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-syndic.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt_common.fish /usr/share/fish/vendor_completions.d
pkg/common/salt.bash /usr/share/bash-completions/completions/salt-common.bash
pkg/common/fish-completions/salt-minion.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-key.fish /usr/share/fish/vendor_completions.d
pkg/common/fish-completions/salt-master.fish /usr/share/fish/vendor_completions.d
Expand Down
3 changes: 3 additions & 0 deletions pkg/debian/salt-common.links
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
opt/saltstack/salt/salt-pip /usr/bin/salt-pip
opt/saltstack/salt/salt-call /usr/bin/salt-call
usr/share/bash-completion/completions/salt usr/share/bash-completion/completions/salt-call
usr/share/bash-completion/completions/salt usr/share/bash-completion/completions/salt-cp
usr/share/bash-completion/completions/salt usr/share/bash-completion/completions/salt-key
19 changes: 19 additions & 0 deletions tests/pytests/pkg/integration/test_bash_completion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pathlib


def test_bash_completion_installed(grains):
# This test specifically checks for a regression of #66560.
if grains.get("os_family") == "Debian":
completions_dir = pathlib.Path("/usr/share/bash-completion/completions")
for exec_name in ("salt", "salt-call", "salt-cp", "salt-key"):
# Bash-completion finds the completion when it is installed as
# <command>, <command>.bash, or _<command>, so we test all three
# variants before failing.
completion_file1 = completions_dir / exec_name
completion_file2 = completions_dir / f"{exec_name}.bash"
completion_file3 = completions_dir / f"_{exec_name}"
assert (
completion_file1.exists()
or completion_file2.exists()
or completion_file3.exists()
)

0 comments on commit be4bfbe

Please sign in to comment.