OSError exception from host.mkdir() if existing entry and force=True
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Fix Released
|
Undecided
|
Jorge Niedbalski |
Bug Description
mkdir will unlink the directory entry found for the path to be created if it exists and force=True, but it never creates the directory.
# touch /tmp/test
# cat > test.py << EOF
from charmhelpers.core import host
host.mkdir(
host.mkdir(
EOF
# python test.py
Well, that's not a real test, but the first call will log "INFO juju-log Making dir /etc/apache2/
The second call with force=True will unlink, not create the dir, and then attempt to chown the non-existent directory which throws and exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/var/lib/
os.
OSError: [Errno 2] No such file or directory: '/tmp/test'
Related branches
- Yaguang Tang (community): Approve
- charmers: Pending requested
-
Diff: 27 lines (+5/-1)1 file modifiedcharmhelpers/core/host.py (+5/-1)
Changed in charm-helpers: | |
assignee: | nobody → Robert C Jennings (rcj) |
status: | New → In Progress |
assignee: | Robert C Jennings (rcj) → nobody |
status: | In Progress → New |
summary: |
- host.mkdir() does not create directory if existing entry and force=True + OSError exception from host.mkdir() if existing entry and force=True |
Changed in charm-helpers: | |
assignee: | nobody → Jorge Niedbalski (niedbalski) |
Changed in charm-helpers: | |
status: | New → Fix Released |