Skip to content

Commit

Permalink
Cleanup hashicorp#2
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Templin committed Apr 3, 2018
1 parent 5dafa72 commit 7027983
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions builtin/provisioners/chef/resource_provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,33 @@ func TestResourceProvider_Validate_good_local_mode(t *testing.T) {
}

func TestResourceProvider_Validate_bad(t *testing.T) {
// chef_repo missing and conflict with server_url
c := testConfig(t, map[string]interface{}{
"use_local_mode": true,
"environment": "_default",
"run_list": []interface{}{"cookbook::recipe"},
"server_url": "https://chef.local",
"invalid": "nope",
})

warn, errs := Provisioner().Validate(c)
if len(warn) > 0 {
t.Fatalf("Warnings: %v", warn)
}
if len(errs) < 2 {
if len(errs) == 0 {
t.Fatalf("Should have errors")
}
}

func TestResourceProvider_Validate_bad_zero(t *testing.T) {
func TestResourceProvider_Validate_bad_local_mode(t *testing.T) {
// chef_repo missing and conflict with server_url
c := testConfig(t, map[string]interface{}{
"invalid": "nope",
"use_local_mode": true,
"environment": "_default",
"run_list": []interface{}{"cookbook::recipe"},
"server_url": "https://chef.local",
})

warn, errs := Provisioner().Validate(c)
if len(warn) > 0 {
t.Fatalf("Warnings: %v", warn)
}
if len(errs) == 0 {
if len(errs) < 2 {
t.Fatalf("Should have errors")
}
}
Expand Down Expand Up @@ -210,7 +210,6 @@ func TestResourceProvider_runChefClient(t *testing.T) {
}

p.runChefClient = p.runChefClientFunc(tc.ChefCmd, tc.ConfDir)

p.useSudo = !p.PreventSudo

err = p.runChefClient(o, c)
Expand Down
4 changes: 2 additions & 2 deletions website/docs/provisioners/chef.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ resource "aws_instance" "web" {
# ...
provisioner "chef" {
use_local_mode = true
use_local_mode = true
use_policyfile = true
policy_name = "example"
chef_repo = "${path.module}/chef/example"
Expand All @@ -91,7 +91,7 @@ The following arguments are supported:
* `chef_repo (string)` - (Optional) Path to a directory containing the chef repo that is to
be used for the chef-client run. The directory can be a typical environment cookbook, containing
the subdirectories `cookbooks`, `environments`, `roles`, `data_bags`. Or it can be a Policyfile
directory as created by `chef export`. In this case, `use_policyfile` etc. need to be set
directory as created by `chef export`. In this case `use_policyfile` etc. need to be set
accordingly.

* `attributes_json (string)` - (Optional) A raw JSON string with initial node attributes
Expand Down

0 comments on commit 7027983

Please sign in to comment.