chef-partners/azure-chef-extension

Azure chef extension policyfile support - 1210.13.4.1

Closed this issue · 8 comments

Describe the bug


Team,

We are trying to enable chef-extension on providing policyfile details while using the 1210.13.4.1 extension.
When we are trying to enable through azure arm template, as mentioned in https://github.com/chef-partners/azure-chef-extension, the chef-extension is getting deployed successfully, but policy details are not getting reflected on the node.

Can you please suggest, how to define the arm template for deploying chef-extn with policy file? We have our ARM template defined as the following. Note: We've already tried and it fails when "custom_json_attr" is kept outside "settings" with this exception: 'Could not find member 'custom_json_attr' on object of type 'TemplateResource'.

 {
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "XXXXXXXXXXXXXXXXXXXX",
            "apiVersion": "2017-12-01",
            "location": "XXXXXXXXXXXXXXXXXXXX",
            "properties": {
              "publisher": "Chef.Bootstrap.WindowsAzure",
              "type": "XXXXXXXXXXXXXXXXXXXX",
              "typeHandlerVersion": "XXXXXXXXXXXXXXXXXXXX",
              "settings": {
                "custom_json_attr": {
                  "policy_name": "AzurePolicyfile",
                  "policy_group": "Development"
                },
                "bootstrap_options": {
                  "chef_node_name" : "XXXXXXXXXXXXXXXXXXXX",
                  "chef_server_url" : "XXXXXXXXXXXXXXXXXXXX",
                  "validation_client_name" : "XXXXXXXXXXXXXXXXXXXX",
                  "environment" : "XXXXXXXXXXXXXXXXXXXX"
                },
                "chef_daemon_interval": "30",
                "CHEF_LICENSE" : "accept-no-persist"
              },
              "protectedSettings": {
                  "validation_key": "XXXXXXXXXXXXXXXXXXXX"
              }
            }
          }

To Reproduce

Bootstrap a node with azure extension 1210.13.4.1 and the arm template above

Expected behavior

The node is bootstrapped and its config is defined by a policy_name and policy_group

Actual behavior

After the attempted bootstrap, the system has not had the policy_name, policy_group defined under custom_json_attr

Additional context

This seems to have been working in https://github.com/chef-partners/azure-chef-extension/releases/tag/1210.13.2.3, but has maybe stopped since then?

#259

Hi @sean-horn, this issue is not reproducible in latest version, can you please try using latest azure chef extension version 1210.13.5.2.
Thank you!

Any updates @sean-horn ?

@sean-horn this is the template that we used

 "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "***",
      "apiVersion": "2020-12-01",
      "location": "***",      
      "properties": {
      "publisher": "Chef.Bootstrap.WindowsAzure",
      "type": "ChefClient",
      "typeHandlerVersion": "1210.13",
      "settings": {
          "bootstrap_options": {
            "chef_node_name": "***",
            "chef_server_url": "***",
            "validation_client_name": "***"
           },      
           "daemon": "task",
           "chef_daemon_interval": 18,          
           "environment_variables": {
               "first": "a",
               "second": "b"           
            },
           "custom_json_attr": {
               "policy_name": "ayushpolicy",
               "policy_group": "ayu-policygroup"
           },          
           "protectedSettings": {
              "validation_key": "***"                     
            }
        }     

We are able to see policy_name and policy_group in chef/0.settings file under custom_json_attr option as well as in node generated in chef-manage portal also.

@sean-horn we will be closing this issue as it is not occurring with latest version, you can reopen the issue if it reoccurs.
For any further assistance please let us know.

Thank you!

@sean-horn We have tested with ubuntu20 and ubuntu18 by deploying azure chef extension with template and we are getting policyname and policy_group in our node.

Can you please provide all log files from your vm - i.e chef.client.log , custom.log and waagent.log so we can debug further into it.

In linux the location for these logs will be - /var/log/azure/Chef.Bootstrap.WindowsAzure.LinuxChefClient/chef-client.log , /var/log/azure/custom.log and /var/log/waagent.log

Thank you!

Thanks for the update, @ayushbhatt29 I'll ask the customer to review and that they should respond here.

Any updates @sean-horn ?

Hi @sean-horn, we will be closing this issue, feel free to reopen the issue if it reoccurs.
For any further assistance please let us know.

Thank you!