{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/215","repository_url":"https://api.github.com/repos/Azure/azure-linux-extensions","labels_url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/215/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/215/comments","events_url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/215/events","html_url":"https://github.com/Azure/azure-linux-extensions/issues/215","id":169211756,"number":215,"title":"[CustomScript] extension blocks deployment when using bare command line","user":{"login":"rcarmo","id":392683,"avatar_url":"https://avatars.githubusercontent.com/u/392683?v=3","gravatar_id":"","url":"https://api.github.com/users/rcarmo","html_url":"https://github.com/rcarmo","followers_url":"https://api.github.com/users/rcarmo/followers","following_url":"https://api.github.com/users/rcarmo/following{/other_user}","gists_url":"https://api.github.com/users/rcarmo/gists{/gist_id}","starred_url":"https://api.github.com/users/rcarmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcarmo/subscriptions","organizations_url":"https://api.github.com/users/rcarmo/orgs","repos_url":"https://api.github.com/users/rcarmo/repos","events_url":"https://api.github.com/users/rcarmo/events{/privacy}","received_events_url":"https://api.github.com/users/rcarmo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-03T19:22:00Z","updated_at":"2016-08-04T09:24:45Z","closed_at":null,"body":"I've been trying to get this extension to do the simplest thing that could possibly work, which is to run a single command line upon provisioning:\r\n\r\n```json\r\n        \"settings\": {\r\n          \"commandToExecute\": \"sudo apt-get -y update && sudo apt-get -y dist-upgrade\"\r\n        }\r\n```\r\n\r\nBut whenever I try to do this, my deployments never finish - the extension is created, its provisioning state is set to \"running\", but I don't get any debug output when looking at the properties blade for the extension on the machine it's provisioned for.\r\n\r\nLooking at the code, I believe it is blowing up at:\r\n\r\na) [Line 192](https://github.com/Azure/azure-linux-extensions/blob/master/CustomScript/customscript.py#L192), where blob_uris is tested for lack of content, even though the documentation states that the `fileUris`array is optional. This because [Line 179](https://github.com/Azure/azure-linux-extensions/blob/master/CustomScript/customscript.py#L179) would seem to return `None` in case the setting is missing.\r\n\r\nb) [Line 278](https://github.com/Azure/azure-linux-extensions/blob/master/CustomScript/customscript.py#L278) and following, given that the command line might be mangled by `parse_args` - which goes against expectations for a Linux sysadmin.\r\n\r\nIn short, the extension should cover the case of running a bare command line (I would also vastly prefer to be able to inline a full script rather than having to manage access to a storage account, but I'll file issue #216 for that).\r\n\r\nFor completion, here's the relevant resource in the ARM template I'm using:\r\n\r\n```json\r\n    {\r\n      \"type\": \"Microsoft.Compute/virtualMachines/extensions\",\r\n      \"copy\": {\r\n        \"name\": \"rancher-master-provisioning-loop\",\r\n        \"count\": \"[parameters('masterCount')]\"\r\n      },\r\n      \"name\": \"[concat(parameters('virtualMachineNameMaster'), copyIndex(), '/updatePackages')]\",\r\n      \"apiVersion\": \"2015-06-15\",\r\n      \"location\": \"[resourceGroup().location]\",\r\n      \"properties\": {\r\n        \"publisher\": \"Microsoft.OSTCExtensions\",\r\n        \"type\": \"CustomScriptForLinux\",\r\n        \"typeHandlerVersion\": \"1.5\",\r\n        \"autoUpgradeMinorVersion\": true,\r\n        \"settings\": {\r\n          \"commandToExecute\": \"sh sudo apt-get -y update && sudo apt-get -y dist-upgrade\"\r\n        }\r\n      },\r\n      \"dependsOn\": [\r\n        \"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineNameMaster'), copyIndex())]\"\r\n      ]\r\n    },\r\n```"},"comment":{"url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/comments/237500661","html_url":"https://github.com/Azure/azure-linux-extensions/issues/215#issuecomment-237500661","issue_url":"https://api.github.com/repos/Azure/azure-linux-extensions/issues/215","id":237500661,"user":{"login":"rcarmo","id":392683,"avatar_url":"https://avatars.githubusercontent.com/u/392683?v=3","gravatar_id":"","url":"https://api.github.com/users/rcarmo","html_url":"https://github.com/rcarmo","followers_url":"https://api.github.com/users/rcarmo/followers","following_url":"https://api.github.com/users/rcarmo/following{/other_user}","gists_url":"https://api.github.com/users/rcarmo/gists{/gist_id}","starred_url":"https://api.github.com/users/rcarmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcarmo/subscriptions","organizations_url":"https://api.github.com/users/rcarmo/orgs","repos_url":"https://api.github.com/users/rcarmo/repos","events_url":"https://api.github.com/users/rcarmo/events{/privacy}","received_events_url":"https://api.github.com/users/rcarmo/received_events","type":"User","site_admin":false},"created_at":"2016-08-04T09:24:45Z","updated_at":"2016-08-04T09:24:45Z","body":"I just tried it again, with `\"sh whoami\"` as `commandToExecute`. The ARM deployment is stuck, and clicking on the Extensions option on the VM properties blade gives me this:\r\n\r\n```\r\nType Microsoft.OSTCExtensions.CustomScriptForLinux\r\nVersion 1.*\r\nStatus (unavailable)\r\nStatus level (unavailable)\r\nStatus message (unavailable)\r\nHandler status Not Ready\r\nHandler status level Info\r\n```"}}
{"actor":{"display_login":"rcarmo"}}