chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

Windows bootstrap incorrectly setting policy_name and policy_group #432

Closed BryceAshey closed 6 years ago

BryceAshey commented 7 years ago

I'm bootstrapping a set of windows nodes and setting --policy_name and --policy_group when doing so. This sets the policy_name and policy_group under a "normal" object rather than the regular policy_name/policy_group parameters. This is visible by doing a knife node edit immediately after a bootstrap. Examples below:

Knife Command:

knife bootstrap windows winrm \"{serverFqdn.ToLower()}\" --install-as-service -N \"{serverFqdn.ToLower()}\" -x \"{runAsDomain}\{runAsUsername}\" -P \"{runAsKey}\" --policy-group \"{policyGroup}\" --policy-name \"{policyName}\" --environment \"{environmentName}\""

Results In:

{ "name": "*", "chef_environment": "", "normal": { "policy_name": "fde5dd40_d83c_49d2_81ec_d831c23273a1__cb878c47_94f2_42a1_a5dd_ef22c285310b", "policy_group": "fde5dd40_d83c_49d2_81ec_d831c23273a1", "tags": [ ] }, "policy_name": "", "policy_group": "", "run_list": [ "recipe[default::default]"] }

This requires us to run a knife node edit to properly set the root policy_name and policy_group resulting in:

{ "name": "", "chef_environment": "", "normal": { "policy_name": "fde5dd40_d83c_49d2_81ec_d831c23273a1cb878c47_94f2_42a1_a5dd_ef22c285310b", "policy_group": "fde5dd40_d83c_49d2_81ec_d831c23273a1", "tags": [ ] }, "policy_name": "fde5dd40_d83c_49d2_81ec_d831c23273a1cb878c47_94f2_42a1_a5dd_ef22c285310b", "policy_group": "fde5dd40_d83c_49d2_81ec_d831c23273a1", "run_list": [ "recipe[default::default]"] }

A "chef-client" run will then successfully pull down updated revisions of the policy_name.

Version Info: Chef Development Kit Version: 1.3.43 chef-client version: 12.19.36 delivery version: master (dd319aa632c2f550c92a2172b9d1226478fea997) berks version: 5.6.4 kitchen version: 1.16.0

Kind Regards, Bryce

rlaveycal commented 6 years ago

FYI this seems to have been fixed with Chef 12.21. After bootstrap I have

  "normal": {
    "policy_name": "mypol",
    "policy_group": "test",
    "tags": [
    ]
  },
  "policy_name": "mypol",
  "policy_group": "test",