Merge lp:~tvansteenburgh/charm-tools/fix-symlinks into lp:charm-tools/1.3

Proposed by Tim Van Steenburgh
Status: Merged
Merged at revision: 332
Proposed branch: lp:~tvansteenburgh/charm-tools/fix-symlinks
Merge into: lp:charm-tools/1.3
Diff against target: 74 lines (+16/-4)
3 files modified
charmtools/templates/bash/template.py (+1/-1)
charmtools/templates/python/template.py (+13/-2)
setup.py (+2/-1)
To merge this branch: bzr merge lp:~tvansteenburgh/charm-tools/fix-symlinks
Reviewer Review Type Date Requested Status
Marco Ceppi (community) Approve
Review via email: mp+223976@code.launchpad.net

Description of the change

* Create charm symlinks dynamically when charm is created.
* Ensure charmhelpers destination path exists before syncing.

To post a comment you must log in.
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

Also, need to add bzr to the deb dependencies, otherwise charmhelpers sync will fail.

Revision history for this message
Marco Ceppi (marcoceppi) wrote :

Thanks, LGTM.

review: Approve
332. By Marco Ceppi

[tvansteenburgh] Create charm symlinks dynamically when charm is created. Ensure charmhelpers destination path exists before syncing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmtools/templates/bash/template.py'
2--- charmtools/templates/bash/template.py 2014-05-23 20:26:16 +0000
3+++ charmtools/templates/bash/template.py 2014-06-20 19:02:22 +0000
4@@ -49,7 +49,7 @@
5 template_dir = path.join(here, 'files')
6 if os.path.exists(output_dir):
7 shutil.rmtree(output_dir)
8- shutil.copytree(template_dir, output_dir, symlinks=True)
9+ shutil.copytree(template_dir, output_dir)
10
11 def _template_file(self, config, outfile):
12 if path.islink(outfile):
13
14=== removed symlink 'charmtools/templates/python/files/hooks_symlinked/config-changed'
15=== target was u'hooks.py'
16=== removed symlink 'charmtools/templates/python/files/hooks_symlinked/install'
17=== target was u'hooks.py'
18=== removed symlink 'charmtools/templates/python/files/hooks_symlinked/start'
19=== target was u'hooks.py'
20=== removed symlink 'charmtools/templates/python/files/hooks_symlinked/stop'
21=== target was u'hooks.py'
22=== removed symlink 'charmtools/templates/python/files/hooks_symlinked/upgrade-charm'
23=== target was u'hooks.py'
24=== modified file 'charmtools/templates/python/template.py'
25--- charmtools/templates/python/template.py 2014-05-27 21:23:41 +0000
26+++ charmtools/templates/python/template.py 2014-06-20 19:02:22 +0000
27@@ -54,7 +54,7 @@
28 template_dir = path.join(here, 'files')
29 if os.path.exists(output_dir):
30 shutil.rmtree(output_dir)
31- shutil.copytree(template_dir, output_dir, symlinks=True)
32+ shutil.copytree(template_dir, output_dir)
33
34 def _template_file(self, config, outfile):
35 if path.islink(outfile):
36@@ -75,12 +75,23 @@
37 def _cleanup_hooks(self, config, output_dir):
38 rmdir = 'hooks' if config['symlink'] else 'hooks_symlinked'
39 shutil.rmtree(os.path.join(output_dir, rmdir))
40- if rmdir == 'hooks':
41+
42+ if config['symlink']:
43 os.rename(
44 os.path.join(output_dir, 'hooks_symlinked'),
45 os.path.join(output_dir, 'hooks')
46 )
47+ for link in ['config-changed', 'install', 'start', 'stop',
48+ 'upgrade-charm']:
49+ os.symlink(
50+ os.path.join(output_dir, 'hooks', 'hooks.py'),
51+ os.path.join(output_dir, 'hooks', link)
52+ )
53
54 def _install_charmhelpers(self, output_dir):
55+ helpers_dest = os.path.join(output_dir, 'lib', 'charmhelpers')
56+ if not os.path.exists(helpers_dest):
57+ os.makedirs(helpers_dest)
58+
59 cmd = './scripts/charm_helpers_sync.py -c charm-helpers.yaml'
60 subprocess.check_call(cmd.split(), cwd=output_dir)
61
62=== modified file 'setup.py'
63--- setup.py 2014-06-20 18:35:44 +0000
64+++ setup.py 2014-06-20 19:02:22 +0000
65@@ -14,7 +14,8 @@
66 setup(
67 name='charm-tools',
68 version="1.3.1",
69- packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
70+ packages=find_packages(
71+ exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
72 install_requires=['launchpadlib', 'argparse', 'cheetah', 'pyyaml',
73 'pycrypto', 'paramiko', 'bzr', 'requests',
74 'charmworldlib'],

Subscribers

People subscribed via source and target branches