Comment 3 for bug 1883903

Revision history for this message
Shreenidhi Shedi (sshedi) wrote :

Thanks for the fix.

After applying the fix I'm getting one more error with the same test script I've mentioned in:
https://bugs.launchpad.net/cloud-init/+bug/1883661

```
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?