az cli does not check if the file for --custom-data exists
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
**Describe the bug**
az cli does not check if the file for --custom-data exists in the specified path. When running `az vm create with --custom-data` even if the custom-data file doesn't exist, az cli continues with the execution.
**To Reproduce**
Run `az vm create --custom-data` against a file that doesn't exist, for example:
```bash
user@host:~$ ls -l cloud-init.txt*
-rw-r--r-- 1 user user 248 Feb 3 17:36 cloud-init.txt
user@host:~$ az vm create --name centos79-ci --resource-group rhel7-ci --image OpenLogic:CentOS-LVM:7-LVM:7.9.2020111900 --size Standard_E2ds_v4 --location eastus2 --custom-data cloud-init.txtz --boot-diagnostics-storage rhel79cidiag --tags Automation=Ignore
```
Note that the file " cloud-init.txtz" does not exist yet az cli completes the command.
**Expected behavior**
az cli to exit and fail due to the custom-data file not being present. Present an error "custom-data" file not found.
**Environment summary**
```
Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-debian-buster-sid
Python 3.6.10
Installer: DEB
azure-cli 2.19.1
Extensions:
vm-repair 0.2.4
```
Contributor guide
Assessment
This issue has not been assessed yet.