Merge lp:~cmars/juju-core/local-repo-errmsg into lp:~go-bot/juju-core/trunk

Proposed by Casey Marshall
Status: Merged
Approved by: Casey Marshall
Approved revision: no longer in the source branch.
Merged at revision: 2596
Proposed branch: lp:~cmars/juju-core/local-repo-errmsg
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 73 lines (+20/-5)
3 files modified
cmd/juju/common.go (+8/-0)
cmd/juju/deploy.go (+8/-5)
provider/local/environprovider.go (+4/-0)
To merge this branch: bzr merge lp:~cmars/juju-core/local-repo-errmsg
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+215021@code.launchpad.net

Commit message

Error msg for local charm deploy missing series.

Add error message when unable to resolve series for local repository.
Update juju deploy doc message to describe behavior.

https://codereview.appspot.com/86160043/

Description of the change

Error msg for local charm deploy missing series.

Add error message when unable to resolve series for local repository.
Update juju deploy doc message to describe behavior.

https://codereview.appspot.com/86160043/

To post a comment you must log in.
Revision history for this message
Casey Marshall (cmars) wrote :

Reviewers: mp+215021_code.launchpad.net,

Message:
Please take a look.

Description:
Error msg for local charm deploy missing series.

Add error message when unable to resolve series for local repository.
Update juju deploy doc message to describe behavior.

https://code.launchpad.net/~cmars/juju-core/local-repo-errmsg/+merge/215021

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/86160043/

Affected files (+14, -4 lines):
   A [revision details]
   M cmd/juju/common.go
   M cmd/juju/deploy.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140409180231-hnxao50offx5c4c9
+New revision: <email address hidden>

Index: cmd/juju/common.go
=== modified file 'cmd/juju/common.go'
--- cmd/juju/common.go 2014-04-07 10:05:04 +0000
+++ cmd/juju/common.go 2014-04-09 19:31:16 +0000
@@ -4,6 +4,8 @@
  package main

  import (
+ "fmt"
+
   "launchpad.net/juju-core/charm"
   "launchpad.net/juju-core/cmd"
   "launchpad.net/juju-core/environs"
@@ -65,6 +67,12 @@
   }
   // Otherwise, look up the best supported series for this charm
   if series == "" {
+ if ref.Schema == "local" {
+ possibleUrl := &charm.URL{Reference: ref, Series: "precise"}
+ logger.Errorf(`The series is not specified in the environment
(default-series) or with the charm. Did you mean:
+ %s`, possibleUrl.String())
+ return nil, fmt.Errorf("cannot resolve series for charm: %q", ref)
+ }
    return client.ResolveCharm(ref)
   }
   return &charm.URL{Reference: ref, Series: series}, nil

Index: cmd/juju/deploy.go
=== modified file 'cmd/juju/deploy.go'
--- cmd/juju/deploy.go 2014-04-09 06:35:07 +0000
+++ cmd/juju/deploy.go 2014-04-09 19:31:16 +0000
@@ -49,12 +49,12 @@
  For cs:~user/precise/mysql
    cs:~user/mysql

-For local:precise/mysql
- local:mysql
-
-In all cases, a versioned charm URL will be expanded as expected (for
example,
+In these cases, a versioned charm URL will be expanded as expected (for
example,
  mysql-33 becomes cs:precise/mysql-33).

+However, for local charms, such as local:precise/mysql, one must specify
the
+series.
+
  <service name>, if omitted, will be derived from <charm name>.

  Constraints can be specified when using deploy by specifying the
--constraints

Revision history for this message
Curtis Hovey (sinzui) wrote :

Hi Casey.

I am not a reviewer, just an interested party.

https://codereview.appspot.com/86160043/diff/1/cmd/juju/deploy.go
File cmd/juju/deploy.go (right):

https://codereview.appspot.com/86160043/diff/1/cmd/juju/deploy.go#newcode55
cmd/juju/deploy.go:55: However, for local charms, such as
local:precise/mysql, one must specify the
I see "assuming a current default series of" in the text above. That is
ambiguous. I din't know if that means the charm's default series or the
environment's default-series.

Maybe this phrasing is helpful
     However, for local charms, where the default-series is not specified
in the environment, one must specify the series.

Older versions of juju had default-series in the env template created by
"juju init". Many of my envs have a define default-series because juju
put it there. So new local users of the past few months are the common
victims of this change. Maybe the local template should a default-series
line commented out to help users discover the feature.

https://codereview.appspot.com/86160043/

Revision history for this message
Casey Marshall (cmars) wrote :

Please take a look.

https://codereview.appspot.com/86160043/diff/1/cmd/juju/deploy.go
File cmd/juju/deploy.go (right):

https://codereview.appspot.com/86160043/diff/1/cmd/juju/deploy.go#newcode55
cmd/juju/deploy.go:55: However, for local charms, such as
local:precise/mysql, one must specify the
On 2014/04/09 20:13:33, curtis wrote:
> I see "assuming a current default series of" in the text above. That
is
> ambiguous. I din't know if that means the charm's default series or
the
> environment's default-series.

Added a sentence to disambiguate.

> Maybe this phrasing is helpful
> However, for local charms, where the default-series is not
specified in the
> environment, one must specify the series.

Done.

> Older versions of juju had default-series in the env template created
by "juju
> init". Many of my envs have a define default-series because juju put
it there.
> So new local users of the past few months are the common victims of
this change.
> Maybe the local template should a default-series line commented out to
help
> users discover the feature.

Where does this template live? I see the templates for specific
providers, but none of them contain a commented default-series: as far
as I can tell.

My environment.yaml has a commented default-series, but it was generated
ages ago.

https://codereview.appspot.com/86160043/

Revision history for this message
Casey Marshall (cmars) wrote :

Updated 'juju deploy' doc, what do you think?

https://codereview.appspot.com/86160043/

Revision history for this message
Casey Marshall (cmars) wrote :
Revision history for this message
Tim Penhey (thumper) wrote :

LGTM

perhaps an example in the help doc?

https://codereview.appspot.com/86160043/diff/40001/cmd/juju/deploy.go
File cmd/juju/deploy.go (right):

https://codereview.appspot.com/86160043/diff/40001/cmd/juju/deploy.go#newcode58
cmd/juju/deploy.go:58: environment, one must specify the series.
Worthwhile adding an example here?

https://codereview.appspot.com/86160043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmd/juju/common.go'
--- cmd/juju/common.go 2014-04-09 16:36:12 +0000
+++ cmd/juju/common.go 2014-04-09 22:31:41 +0000
@@ -4,6 +4,8 @@
4package main4package main
55
6import (6import (
7 "fmt"
8
7 "launchpad.net/juju-core/charm"9 "launchpad.net/juju-core/charm"
8 "launchpad.net/juju-core/cmd"10 "launchpad.net/juju-core/cmd"
9 "launchpad.net/juju-core/environs"11 "launchpad.net/juju-core/environs"
@@ -65,6 +67,12 @@
65 }67 }
66 // Otherwise, look up the best supported series for this charm68 // Otherwise, look up the best supported series for this charm
67 if series == "" {69 if series == "" {
70 if ref.Schema == "local" {
71 possibleUrl := &charm.URL{Reference: ref, Series: "precise"}
72 logger.Errorf(`The series is not specified in the environment (default-series) or with the charm. Did you mean:
73 %s`, possibleUrl.String())
74 return nil, fmt.Errorf("cannot resolve series for charm: %q", ref)
75 }
68 return client.ResolveCharm(ref)76 return client.ResolveCharm(ref)
69 }77 }
70 return &charm.URL{Reference: ref, Series: series}, nil78 return &charm.URL{Reference: ref, Series: series}, nil
7179
=== modified file 'cmd/juju/deploy.go'
--- cmd/juju/deploy.go 2014-04-09 16:36:12 +0000
+++ cmd/juju/deploy.go 2014-04-09 22:31:41 +0000
@@ -39,8 +39,7 @@
3939
40const deployDoc = `40const deployDoc = `
41<charm name> can be a charm URL, or an unambiguously condensed form of it;41<charm name> can be a charm URL, or an unambiguously condensed form of it;
42assuming a current default series of "precise", the following forms will be42assuming a current series of "precise", the following forms will be accepted:
43accepted.
4443
45For cs:precise/mysql44For cs:precise/mysql
46 mysql45 mysql
@@ -49,12 +48,16 @@
49For cs:~user/precise/mysql48For cs:~user/precise/mysql
50 cs:~user/mysql49 cs:~user/mysql
5150
52For local:precise/mysql51The current series is determined first by the default-series environment
53 local:mysql52setting, followed by the preferred series for the charm in the charm store.
5453
55In all cases, a versioned charm URL will be expanded as expected (for example,54In these cases, a versioned charm URL will be expanded as expected (for example,
56mysql-33 becomes cs:precise/mysql-33).55mysql-33 becomes cs:precise/mysql-33).
5756
57However, for local charms, when the default-series is not specified in the
58environment, one must specify the series. For example:
59 local:precise/mysql
60
58<service name>, if omitted, will be derived from <charm name>.61<service name>, if omitted, will be derived from <charm name>.
5962
60Constraints can be specified when using deploy by specifying the --constraints63Constraints can be specified when using deploy by specifying the --constraints
6164
=== modified file 'provider/local/environprovider.go'
--- provider/local/environprovider.go 2014-04-02 11:35:49 +0000
+++ provider/local/environprovider.go 2014-04-09 22:31:41 +0000
@@ -262,6 +262,10 @@
262 #262 #
263 # network-bridge: lxcbr0263 # network-bridge: lxcbr0
264264
265 # The default series to deploy the state-server and charms on.
266 #
267 # default-series: precise
268
265`[1:]269`[1:]
266}270}
267271

Subscribers

People subscribed via source and target branches

to status/vote changes: