Merge lp:~cprov/uci-engine/webui-static-assets into lp:uci-engine

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 777
Merged at revision: 776
Proposed branch: lp:~cprov/uci-engine/webui-static-assets
Merge into: lp:uci-engine
Diff against target: 88 lines (+37/-34)
1 file modified
bin/webui-collectstatic.py (+37/-34)
To merge this branch: bzr merge lp:~cprov/uci-engine/webui-static-assets
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+233737@code.launchpad.net

Commit message

Modifying bin/webui-collectstatic.py to collect static files also from external django applications (primarily 'admin').

Description of the change

Modifying bin/webui-collectstatic.py to collect static files also from external django applications (primarily 'admin').

From now on, building the webui charm requires development venv to be activated (for django dependencies).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:776
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1367/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/1367/rebuild

review: Approve (continuous-integration)
Revision history for this message
Joe Talbott (joetalbott) :
review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (100.8 KiB)

The attempt to merge lp:~cprov/uci-engine/webui-static-assets into lp:uci-engine failed. Below is the output from the failed tests.

Running cm...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
uploading webui-content.tgz to swift
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Checking juju status
Private PPAs: disabled
Preparing local branch upload...
Uploading local branch, fingerprint e413e8a2b1d087ec9587ada3d08259791b1bd9dc
Building charm: lander
Building charm: wsgi-app
Building charm: rabbitmq-worker
Building charm: webui
Building charm: key-secret-subordinate
Building charm: system-image-server
Building charm: chroot-builder
Installing keys from bzr+ssh://bazaar.launchpad.net/~ci-engineering-private/+junk/ci-airline-dev-keys/
Running juju-deployer -v -c /tmp/tmpXIEYkW/deployer/branch-source-builder.yaml -c /tmp/tmpXIEYkW/deployer/gatekeeper.yaml -c /tmp/tmpXIEYkW/deployer/image-builder.yaml -c /tmp/tmpXIEYkW/deployer/lander.yaml -c /tmp/tmpXIEYkW/deployer/nf-stats-service.yaml -c /tmp/tmpXIEYkW/deployer/ppa-creator.yaml -c /tmp/tmpXIEYkW/deployer/publisher.yaml -c /tmp/tmpXIEYkW/deployer/relations.yaml -c /tmp/tmpXIEYkW/deployer/test-runner.yaml -c /tmp/tmpXIEYkW/deployer/ticket-system.yaml -c /tmp/tmpXIEYkW/deployer/validator.yaml -c /tmp/tmpXIEYkW/deployer/webui.yaml ci-airline
Tests running...
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testConnectFailed ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testProcessQueue ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testRunForever ... OK (0.101 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testSent ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestProgressTrigger.testProgress ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testCancel ... OK (0.103 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoQueue ... OK (0.004 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoTicket ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageCalledProcessError ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageFail ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageKilled ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageSimple ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageUnexpected ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testSaveLastRun ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCBRuns ... OK (0.021 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCanCancel ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_invalid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_valid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_get_file_name ... OK (0.000 secs)
ci-utils.ci_utils.tes...

777. By Celso Providelo

Test fixing and more informative errors.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/webui-collectstatic.py'
2--- bin/webui-collectstatic.py 2014-05-21 20:56:42 +0000
3+++ bin/webui-collectstatic.py 2014-09-08 20:26:21 +0000
4@@ -14,49 +14,52 @@
5 # You should have received a copy of the GNU Affero General Public License
6 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7
8-import fnmatch
9+import atexit
10 import logging
11 import os
12 import subprocess
13+import shutil
14+import sys
15 import tempfile
16
17-from distutils import dir_util
18+try:
19+ from webui import settings
20+except ImportError:
21+ logging.error(
22+ 'Collect static files requires access to the "webui" module. '
23+ ' Please run this script inside the project venv.')
24+ sys.exit(1)
25
26
27 def main():
28- logging.info("Searching for static directories...")
29- # Directory tree traversal code
30- # taken from http://stackoverflow.com/a/2186565/729970
31- matches = []
32- working_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
33- path = os.path.abspath(os.path.join(working_dir, '..', 'webui'))
34- for root, dirnames, filenames in os.walk(path):
35- for dirname in fnmatch.filter(dirnames, 'static'):
36- # skip the top level static dir since where django collects static
37- # files.
38- skip_path = os.path.join(path, 'static')
39- dir_path = os.path.join(root, dirname)
40-
41- if dir_path == skip_path:
42- continue
43-
44- matches.append(dir_path)
45-
46- logging.info("matches: %s", matches)
47-
48 tmp = tempfile.mkdtemp()
49- tmp_path = os.path.join(tmp, 'static')
50- for dirname in matches:
51- dir_util.copy_tree(dirname, tmp_path, update=True)
52-
53- tarfile = '{}/webui_content.tgz'.format(tmp)
54- subprocess.check_output(['tar', 'czvf', tarfile, '-C', tmp, 'static'])
55-
56- # Change to the temporary directory so swift doesn't add path bits to the
57- # filename
58- os.chdir(tmp)
59- subprocess.check_output(
60- ['swift', 'upload', 'charmblobs', os.path.basename(tarfile)]
61+ atexit.register(shutil.rmtree, tmp)
62+
63+ logging.info("Collecting static assets in {}".format(tmp))
64+
65+ bin_dir = os.path.dirname(os.path.abspath(__file__))
66+ working_dir = os.path.abspath(os.path.join(bin_dir, os.pardir))
67+ manager_path = os.path.join(working_dir, 'webui', 'manage.py')
68+
69+ # Pass explict --settings using shell because 'DJANGO_SETTINGS_MODULE'
70+ # variable might be populated by other django project (ticket-system).
71+ subprocess.check_output(
72+ '{} collectstatic --noinput --settings=webui.settings'.format(
73+ manager_path),
74+ cwd=tmp, shell=True,
75+ )
76+
77+ tarfile = 'webui_content.tgz'
78+ logging.info("Building {}".format(tarfile))
79+ subprocess.check_output(
80+ ['tar', 'czvf', tarfile, settings.STATIC_ROOT],
81+ cwd=tmp,
82+ )
83+
84+ logging.info("Uploading {} to charmblobs".format(tarfile))
85+ subprocess.check_output(
86+ ['swift', 'upload', 'charmblobs', os.path.basename(tarfile)],
87+ cwd=tmp,
88 )
89
90

Subscribers

People subscribed via source and target branches