Merge lp:~alo21/pyjuju/fix-lp956000 into lp:pyjuju

Proposed by Alessandro Losavio
Status: Work in progress
Proposed branch: lp:~alo21/pyjuju/fix-lp956000
Merge into: lp:pyjuju
Diff against target: 15 lines (+2/-3)
1 file modified
juju/environment/ (+2/-3)
To merge this branch: bzr merge lp:~alo21/pyjuju/fix-lp956000
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Needs Fixing
Clint Byrum (community) Needs Fixing
Review via email:

Description of the change

Try to fix bug 956000

To post a comment you must log in.
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Alessandro, thanks for submitting this patch!

Unfortunately, this is not the right way to handle the problem. Printing down deep in classes is too low level and will not allow for graceful changes in the code and/or API later on. Also I suspect you'll get other errors because you don't raise an error (and therefore, the other code keeps executing).

The right way is probably to introduce a new error class, and then use a try/except in any call sites to handle it more gracefully.. like this:

except ThatError, e:

review: Needs Fixing
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Agreed, and the message should only be changed in the very specific case where "juju" is executed without any other arguments. It is really an error to interrupt whatever juju was going to do and stop to print that message.

review: Needs Fixing

Unmerged revisions

545. By Alessandro Losavio

fail to build from source

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/environment/'
2--- juju/environment/ 2012-04-11 01:17:53 +0000
3+++ juju/environment/ 2012-06-24 17:03:19 +0000
4@@ -229,9 +229,8 @@
5 self.load()
6 except FileNotFound:
7 self.write_sample()
8- raise EnvironmentsConfigError("No environments configured. Please "
9- "edit: %s" % self.get_default_path(),
10- sample_written=True)
11+ print("Info: %s does not exist, creating one. Please "
12++ "edit: %s" % self.get_default_path(), self.get_default_path(), sample_written=True)
14 def serialize(self, name=None):
15 """Serialize the environments configuration.


People subscribed via source and target branches

to status/vote changes: