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

fix dst file conflict in template function #61

Merged
merged 2 commits into from
Dec 11, 2021

Conversation

bobuhiro11
Copy link
Contributor

If a template with the same dst is applied to multiple nodes, the file name for dst would conflict.

$ cat <<EOF >spec.yaml
nodes:
  - name: h1
    type: docker
    image: alpine
    vars:
      name: h1
    templates:
    - dst: /tmp/baz.txt
      content: "{{ .name }}"
  - name: h2
    type: docker
    image: alpine
    vars:
      name: h2
    templates:
    - dst: /tmp/baz.txt
      content: "{{ .name }}"
EOF

$ go run . up | sudo sh -x
+ docker run -td --net none --name h1 --rm --privileged --hostname h1 -v /tmp/tinet:/tinet alpine
+ mkdir -p /var/run/netns
+ docker inspect h1 --format {{.State.Pid}}
+ PID=12938
+ ln -s /proc/12938/ns/net /var/run/netns/h1
+ docker run -td --net none --name h2 --rm --privileged --hostname h2 -v /tmp/tinet:/tinet alpine
+ mkdir -p /var/run/netns
+ docker inspect h2 --format {{.State.Pid}}
+ PID=13020
+ ln -s /proc/13020/ns/net /var/run/netns/h2
+ ip netns del h1
+ docker cp baz.txt h1:/tmp/baz.txt
+ rm -rf baz.txt
+ ip netns del h2
+ docker cp baz.txt h2:/tmp/baz.txt
lstat /home/bobuhiro11/tinet/baz.txt: no such file or directory
+ rm -rf baz.txt

Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
@ak1ra24 ak1ra24 merged commit 09da49e into tinynetwork:master Dec 11, 2021
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.

None yet

2 participants