```
Jun 23 11:15:16 phdev cloud-init[1786]: Traceback (most recent call last):
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/bin/cloud-init", line 11, in <module>
Jun 23 11:15:16 phdev cloud-init[1786]: load_entry_point('cloud-init==20.2', 'console_scripts', 'cloud-init')()
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 893, in main
Jun 23 11:15:16 phdev cloud-init[1786]: get_uptime=True, func=functor, args=(name, args))
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 2618, in log_time
Jun 23 11:15:16 phdev cloud-init[1786]: ret = func(*args, **kwargs)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 600, in status_wrapper
Jun 23 11:15:16 phdev cloud-init[1786]: util.ensure_dirs((data_d, link_d,))
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1645, in ensure_dirs
Jun 23 11:15:16 phdev cloud-init[1786]: ensure_dir(d, mode)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/site-packages/cloudinit/util.py", line 1698, in ensure_dir
Jun 23 11:15:16 phdev cloud-init[1786]: os.makedirs(path)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/python3.7/os.py", line 221, in makedirs
Jun 23 11:15:16 phdev cloud-init[1786]: mkdir(name, mode)
Jun 23 11:15:16 phdev cloud-init[1786]: FileExistsError: [Errno 17] File exists: '/var/lib/cloud/data'
Jun 23 11:15:16 phdev systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 11:15:16 phdev systemd[1]: cloud-init.service: Failed with result 'exit-code'.
```
Is it okay to replicate the behavior of 'mkdir -p' for this?
Thanks for the fix.
After applying the fix I'm getting one more error with the same test script I've mentioned in: /bugs.launchpad .net/cloud- init/+bug/ 1883661
https:/
``` cloud-init" , line 11, in <module> point(' cloud-init= =20.2', 'console_scripts', 'cloud-init')() python3. 7/site- packages/ cloudinit/ cmd/main. py", line 893, in main python3. 7/site- packages/ cloudinit/ util.py" , line 2618, in log_time python3. 7/site- packages/ cloudinit/ cmd/main. py", line 600, in status_wrapper dirs((data_ d, link_d,)) python3. 7/site- packages/ cloudinit/ util.py" , line 1645, in ensure_dirs python3. 7/site- packages/ cloudinit/ util.py" , line 1698, in ensure_dir python3. 7/os.py" , line 221, in makedirs cloud/data'
Jun 23 11:15:16 phdev cloud-init[1786]: Traceback (most recent call last):
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/bin/
Jun 23 11:15:16 phdev cloud-init[1786]: load_entry_
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: get_uptime=True, func=functor, args=(name, args))
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: ret = func(*args, **kwargs)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: util.ensure_
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: ensure_dir(d, mode)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: os.makedirs(path)
Jun 23 11:15:16 phdev cloud-init[1786]: File "/usr/lib/
Jun 23 11:15:16 phdev cloud-init[1786]: mkdir(name, mode)
Jun 23 11:15:16 phdev cloud-init[1786]: FileExistsError: [Errno 17] File exists: '/var/lib/
Jun 23 11:15:16 phdev systemd[1]: cloud-init.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 11:15:16 phdev systemd[1]: cloud-init.service: Failed with result 'exit-code'.
```
Is it okay to replicate the behavior of 'mkdir -p' for this?