Merge lp:~therve/pyjuju/ignore-dot-files into lp:pyjuju

Proposed by Thomas Herve
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 535
Merged at revision: 550
Proposed branch: lp:~therve/pyjuju/ignore-dot-files
Merge into: lp:pyjuju
Diff against target: 37 lines (+16/-0)
2 files modified
juju/charm/repository.py (+2/-0)
juju/charm/tests/test_repository.py (+14/-0)
To merge this branch: bzr merge lp:~therve/pyjuju/ignore-dot-files
Reviewer Review Type Date Requested Status
Kapil Thangavelu (community) Approve
Review via email: mp+104592@code.launchpad.net

Description of the change

Charm repo ignores entry with leading '.'

Minor optimization to skip invalid entries.

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

lgtm, thanks

review: Approve
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

*** Submitted:

Charm repo ignores entry with leading '.'

Minor optimization to skip invalid entries.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/charm/repository.py'
2--- juju/charm/repository.py 2012-04-04 13:00:13 +0000
3+++ juju/charm/repository.py 2012-05-03 18:48:26 +0000
4@@ -50,6 +50,8 @@
5 return
6
7 for dentry in os.listdir(path):
8+ if dentry.startswith("."):
9+ continue
10 dentry_path = os.path.join(path, dentry)
11 try:
12 yield get_charm_from_path(dentry_path)
13
14=== modified file 'juju/charm/tests/test_repository.py'
15--- juju/charm/tests/test_repository.py 2012-03-27 20:07:54 +0000
16+++ juju/charm/tests/test_repository.py 2012-05-03 18:48:26 +0000
17@@ -174,6 +174,20 @@
18 "%s/series/mysql/config.yaml" % self.repository1.path, output)
19
20 @inlineCallbacks
21+ def test_ignore_dot_files(self):
22+ """Dot files are ignored when browsing the repository."""
23+ fh = open(
24+ os.path.join(
25+ self.repository1.path, "series", ".foo"),
26+ "w+")
27+
28+ fh.write("Something")
29+ fh.close()
30+ yield self.repository1.find(self.charm_url("sample"))
31+ output = self.output.getvalue()
32+ self.assertNotIn("Charm '.foo' has an error", output)
33+
34+ @inlineCallbacks
35 def test_invalid_charm_config_ignored(self):
36 fh = open(
37 os.path.join(

Subscribers

People subscribed via source and target branches

to status/vote changes: