Merge lp:~lutostag/charms/trusty/logstash/trunk+local-download-fix into lp:~lazypower/charms/trusty/logstash/trunk

Proposed by Greg Lutostanski
Status: Rejected
Rejected by: Charles Butler
Proposed branch: lp:~lutostag/charms/trusty/logstash/trunk+local-download-fix
Merge into: lp:~lazypower/charms/trusty/logstash/trunk
Diff against target: 45 lines (+11/-6)
1 file modified
hooks/install (+11/-6)
To merge this branch: bzr merge lp:~lutostag/charms/trusty/logstash/trunk+local-download-fix
Reviewer Review Type Date Requested Status
Charles Butler Pending
Review via email: mp+229997@code.launchpad.net

Description of the change

Just two minor fixes:
One to get downloaded files to work appropriately.
And do not try to install '' extra packages.

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

Greg, apologies on missing this merge - I've refactored the charm quite a bit and this no longer cleanly applies. I'll dig into this later and get it merged in.

Thanks for the fix!

Revision history for this message
Charles Butler (lazypower) wrote :

This was fixed in my latest upstream copy. Thanks for the contribution - i used it as a reference.

Unmerged revisions

19. By Greg Lutostanski

fix using downloaded logstash.tar.gz in charm/files and install of no extra packages by default

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/install'
--- hooks/install 2014-07-24 13:26:45 +0000
+++ hooks/install 2014-08-07 19:33:20 +0000
@@ -8,6 +8,7 @@
8import subprocess8import subprocess
9import sys9import sys
10import tarfile10import tarfile
11import tempfile
1112
12sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))13sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))
1314
@@ -36,7 +37,7 @@
36 extra_packages = config('extra-packages')37 extra_packages = config('extra-packages')
37 apt_update(fatal=True)38 apt_update(fatal=True)
38 apt_install(packages, fatal=True)39 apt_install(packages, fatal=True)
39 if extra_packages is not None:40 if extra_packages:
40 apt_install(extra_packages, fatal=True)41 apt_install(extra_packages, fatal=True)
4142
42 # Place default redis template43 # Place default redis template
@@ -82,15 +83,19 @@
82 sha.hexdigest()))83 sha.hexdigest()))
8384
84 # Extract and move into place85 # Extract and move into place
85 extract_package(filename)86 extract_package(fpath)
8687
8788
88def extract_package(filename):89def extract_package(filename):
89 t = tarfile.open(os.path.join(os.path.sep, 'tmp', filename))90 tempdir = tempfile.mkdtemp()
90 t.extractall(path='.')91 t = tarfile.open(filename)
92 t.extractall(path=tempdir)
91 t.close()93 t.close()
92 basename = filename.rsplit('.', 2)[0]94 dirnames = os.listdir(tempdir)
93 shutil.move(basename, BASEPATH)95 if not len(dirnames) == 1:
96 raise ValueError('Did not extract archive correctly to %s' % tempdir)
97 shutil.move(os.path.join(tempdir, dirnames[0]), BASEPATH)
98 shutil.rmtree(tempdir)
9499
95100
96def create_skeleton():101def create_skeleton():

Subscribers

People subscribed via source and target branches