Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scandirectory follow symlinks #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

oholiab
Copy link
Contributor

@oholiab oholiab commented Dec 18, 2019

This enables the use of symlinked files and directories in config directories:

root@46597d0d80f5:/work/linktest# ls
root@46597d0d80f5:/work/linktest# mkdir conf.d
root@46597d0d80f5:/work/linktest# mkdir linksources
root@46597d0d80f5:/work/linktest# cat > conf.d/unlinked-policy.hcl
environment "all" {
        policy "unlinked-policy" {
                path "blah" {
                        capabilities = ["read"]
                }
        }
}
root@46597d0d80f5:/work/linktest# cat > linksources/linked-policy.hcl
environment "all" {
        policy "linked-policy" {
                path "bleh" {
                        capabilities = ["read"]
                }
        }
}
root@46597d0d80f5:/work/linktest/conf.d# cat > /abslinked-policy.hcl
environment "all" {
        policy "abslinked-policy" {
                path "bler" {
                        capabilities = ["read"]
                }
        }
}
root@46597d0d80f5:/work/linktest# cd conf.d/
root@46597d0d80f5:/work/linktest/conf.d# ln -s ../linksources/linked-policy.hcl
root@46597d0d80f5:/work/linktest/conf.d# ln -s /abslinked-policy.hcl
root@46597d0d80f5:/work/linktest/conf.d# cd ..
root@46597d0d80f5:/work/linktest# ls -l conf.d/
total 4
lrwxrwxrwx 1 root root  21 Dec 18 16:18 abslinked-policy.hcl -> /abslinked-policy.hcl
lrwxrwxrwx 1 root root  32 Dec 18 16:10 linked-policy.hcl -> ../linksources/linked-policy.hcl
-rw-r--r-- 1 root root 163 Dec 18 16:00 unlinked-policy.hcl

# Current version without symlink fix, only deployes the unlinked policy
root@46597d0d80f5:/work/linktest# hashi-helper --environment all --config-dir conf.d/ vault-push-all
INFO[0000] Writing policy unlinked-policy

# This patch, pushes all of them
root@46597d0d80f5:/work/linktest# ../hashi-helper --environment all --config-dir conf.d/ vault-push-all
INFO[0000] Writing policy abslinked-policy
INFO[0000] Writing policy linked-policy
INFO[0000] Writing policy unlinked-policy
root@46597d0d80f5:/work/linktest#

If we could get a new minor version release on merge that would really help me out with getting it deployed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants