diff --git a/builtin/provisioners/chef/resource_provisioner_test.go b/builtin/provisioners/chef/resource_provisioner_test.go index fe9352ef0aff..f9c78ec87943 100644 --- a/builtin/provisioners/chef/resource_provisioner_test.go +++ b/builtin/provisioners/chef/resource_provisioner_test.go @@ -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") } } @@ -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) diff --git a/website/docs/provisioners/chef.html.markdown b/website/docs/provisioners/chef.html.markdown index b6661fdbd655..b3335baba832 100644 --- a/website/docs/provisioners/chef.html.markdown +++ b/website/docs/provisioners/chef.html.markdown @@ -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" @@ -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