Skip to content

Commit

Permalink
include playbook root dir into dependencies search
Browse files Browse the repository at this point in the history
  • Loading branch information
meomap committed Sep 1, 2018
1 parent 29c5a14 commit 1255158
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
*.out
vendor
zeno
dist
2 changes: 1 addition & 1 deletion parser/playbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func ParsePlaybook(filePath string, repoDir string, ds loader.DataSource) ([]str
return nil, errors.Wrapf(err, "yaml.Unmarshal file_path=%s", filePath)
}
playbookRoot := filepath.Dir(path.Join(repoDir, filePath))
deps := []string{}
deps := []string{playbookRoot}
for _, play := range playbook {
for _, role := range play.Roles {
roleDeps, rErr := parseRole(role.Name, playbookRoot, ds)
Expand Down
8 changes: 4 additions & 4 deletions parser/playbook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestParsePlaybook(t *testing.T) {
hosts: all`))
},

want: []string{},
want: []string{"."},
},
{
caseName: "playbook_with_single_role_explicit_path",
Expand All @@ -42,7 +42,7 @@ func TestParsePlaybook(t *testing.T) {
`))
ds.SetFile("roles/r1", []byte(""))
},
want: []string{"roles/r1"},
want: []string{".", "roles/r1"},
},
{
caseName: "playbook_with_single_role_implicit_path",
Expand All @@ -56,7 +56,7 @@ func TestParsePlaybook(t *testing.T) {
`))
ds.SetFile("roles/r2", []byte(""))
},
want: []string{"roles/r2"},
want: []string{".", "roles/r2"},
},
{
caseName: "playbook_with_multiple_roles",
Expand All @@ -72,7 +72,7 @@ func TestParsePlaybook(t *testing.T) {
ds.SetFile("roles/r1", []byte(""))
ds.SetFile("roles/r2", []byte(""))
},
want: []string{"roles/r1", "roles/r2"},
want: []string{".", "roles/r1", "roles/r2"},
},
{
caseName: "playbook_not_exist",
Expand Down

0 comments on commit 1255158

Please sign in to comment.