Skip to content

Commit 1255158

Browse files
committed
include playbook root dir into dependencies search
1 parent 29c5a14 commit 1255158

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
*.out
1313
vendor
1414
zeno
15+
dist

parser/playbook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func ParsePlaybook(filePath string, repoDir string, ds loader.DataSource) ([]str
4242
return nil, errors.Wrapf(err, "yaml.Unmarshal file_path=%s", filePath)
4343
}
4444
playbookRoot := filepath.Dir(path.Join(repoDir, filePath))
45-
deps := []string{}
45+
deps := []string{playbookRoot}
4646
for _, play := range playbook {
4747
for _, role := range play.Roles {
4848
roleDeps, rErr := parseRole(role.Name, playbookRoot, ds)

parser/playbook_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestParsePlaybook(t *testing.T) {
2828
hosts: all`))
2929
},
3030

31-
want: []string{},
31+
want: []string{"."},
3232
},
3333
{
3434
caseName: "playbook_with_single_role_explicit_path",
@@ -42,7 +42,7 @@ func TestParsePlaybook(t *testing.T) {
4242
`))
4343
ds.SetFile("roles/r1", []byte(""))
4444
},
45-
want: []string{"roles/r1"},
45+
want: []string{".", "roles/r1"},
4646
},
4747
{
4848
caseName: "playbook_with_single_role_implicit_path",
@@ -56,7 +56,7 @@ func TestParsePlaybook(t *testing.T) {
5656
`))
5757
ds.SetFile("roles/r2", []byte(""))
5858
},
59-
want: []string{"roles/r2"},
59+
want: []string{".", "roles/r2"},
6060
},
6161
{
6262
caseName: "playbook_with_multiple_roles",
@@ -72,7 +72,7 @@ func TestParsePlaybook(t *testing.T) {
7272
ds.SetFile("roles/r1", []byte(""))
7373
ds.SetFile("roles/r2", []byte(""))
7474
},
75-
want: []string{"roles/r1", "roles/r2"},
75+
want: []string{".", "roles/r1", "roles/r2"},
7676
},
7777
{
7878
caseName: "playbook_not_exist",

0 commit comments

Comments
 (0)