Error deploying website with apache-php
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
New
|
Undecided
|
Unassigned |
Bug Description
I got an error when deploying a website using apache-php.
Context: You can pass it a URL for a compressed file which it will automatically download and unpack into /var/www/<sitename> during the setup process. Also, sometimes this packages have all meaningful files inside a subdirectory, for easying the unpacking. The apache-php layer tries to dectect that and moves that subdir out of the path bringing it's contents to the parent dir.
Problem: when the subdir have the same name of the website dir it will try to move a dir to the parent subdirectory which already have a one with the same name, and it fails.
It needs to detect this case and move the subdir to a temporary name before moving to the parent dir.
Evidence:
unit-nextcloud-17: 16:31:12 INFO unit.nextcloud/
unit-nextcloud-17: 16:31:26 ERROR unit.nextcloud/
Traceback (most recent call last):
File "/usr/local/
bus.
File "/usr/local/
_invoke(
File "/usr/local/
handler.
File "/usr/local/
self.
File "/var/lib/
install_
File "/var/lib/
strip_
File "/var/lib/
os.
OSError: [Errno 39] Directory not empty: '/var/www/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 DEBUG unit.nextcloud/
unit-nextcloud-17: 16:31:26 ERROR juju.worker.
unit-nextcloud-17: 16:31:26 INFO juju.worker.uniter awaiting error resolution for "install" hook
The following patch fixes it:
diff -uNr nextcloud_
--- nextcloud_
+++ nextcloud/
@@ -94,6 +94,11 @@
subdir = os.path.
if not os.path.
return
+ # check for the case where subdir have the same name of the parent
+ if os.path.
+ os.rename(subdir, subdir+"_tmp")
+ contents = os.listdir(
+ subdir = os.path.
tmp_dest = os.path.
os.
os.
Sorry I guess this is the wrong place for this bug. Uppon more investigation it seems that layers get downloaded from github in realtime and are not present on any package.
I will submit a pull request to the project on github.
This can be closed. Thank you.