Merge lp:~thumper/juju-core/fix-windows-build into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 1829
Proposed branch: lp:~thumper/juju-core/fix-windows-build
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 129 lines (+19/-10)
5 files modified
environs/cloudinit.go (+1/-0)
environs/cloudinit/cloudinit.go (+5/-5)
scripts/win-installer/setup.iss (+1/-1)
upstart/service.go (+4/-4)
utils/file.go (+8/-0)
To merge this branch: bzr merge lp:~thumper/juju-core/fix-windows-build
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+186225@code.launchpad.net

Commit message

Make bootstrap work from a windows client.

This change uses path rather than filepath for the Join
methods for the cloudinit and upstart job creation.

This is because the client OS may be windows, but the
code is running on linux server-side.

A util function has been added that should be used in
the agent and worker code to ease the transition to
supporting windows as a server OS.

The generated cloudinit content for new machines is
logged out at TRACE level to provide debugging info.

This is already on the lp:juju-core/1.14 branch.

https://codereview.appspot.com/13241053/

Description of the change

Make bootstrap work from a windows client.

This change uses path rather than filepath for the Join
methods for the cloudinit and upstart job creation.

This is because the client OS may be windows, but the
code is running on linux server-side.

A util function has been added that should be used in
the agent and worker code to ease the transition to
supporting windows as a server OS.

The generated cloudinit content for new machines is
logged out at TRACE level to provide debugging info.

This is already on the lp:juju-core/1.14 branch.

https://codereview.appspot.com/13241053/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :
Download full text (5.2 KiB)

Reviewers: mp+186225_code.launchpad.net,

Message:
Please take a look.

Description:
Make bootstrap work from a windows client.

This change uses path rather than filepath for the Join
methods for the cloudinit and upstart job creation.

This is because the client OS may be windows, but the
code is running on linux server-side.

A util function has been added that should be used in
the agent and worker code to ease the transition to
supporting windows as a server OS.

The generated cloudinit content for new machines is
logged out at TRACE level to provide debugging info.

This is already on the lp:juju-core/1.14 branch.

https://code.launchpad.net/~thumper/juju-core/fix-windows-build/+merge/186225

(do not edit description out of merge proposal)

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

Affected files (+21, -10 lines):
   A [revision details]
   M environs/cloudinit.go
   M environs/cloudinit/cloudinit.go
   M scripts/win-installer/setup.iss
   M upstart/service.go
   M utils/file.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-20130917082542-j1hu82fubd89ombo
+New revision: <email address hidden>

Index: environs/cloudinit.go
=== modified file 'environs/cloudinit.go'
--- environs/cloudinit.go 2013-09-16 22:02:24 +0000
+++ environs/cloudinit.go 2013-09-18 01:25:45 +0000
@@ -126,6 +126,7 @@
    return nil, err
   }
   data, err := cloudcfg.Render()
+ logger.Tracef("Generated cloud init:\n%s", string(data))
   if err != nil {
    return nil, err
   }

Index: upstart/service.go
=== modified file 'upstart/service.go'
--- upstart/service.go 2013-09-16 22:02:24 +0000
+++ upstart/service.go 2013-09-18 01:25:45 +0000
@@ -5,7 +5,7 @@

  import (
   "fmt"
- "path/filepath"
+ "path"

   "launchpad.net/juju-core/utils"
  )
@@ -17,7 +17,7 @@

  // MongoUpstartService returns the upstart config for the mongo state
service.
  func MongoUpstartService(name, dataDir, dbDir string, port int) *Conf {
- keyFile := filepath.Join(dataDir, "server.pem")
+ keyFile := path.Join(dataDir, "server.pem")
   svc := NewService(name)
   return &Conf{
    Service: *svc,
@@ -44,7 +44,7 @@
  // based on the tag and machineId passed in.
  func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag,
machineId string, env map[string]string) *Conf {
   svc := NewService(name)
- logFile := filepath.Join(logDir, tag+".log")
+ logFile := path.Join(logDir, tag+".log")
   // The machine agent always starts with debug turned on. The logger
worker
   // will update this to the system logging environment as soon as it
starts.
   return &Conf{
@@ -53,7 +53,7 @@
    Limit: map[string]string{
     "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
    },
- Cmd: filepath.Join(toolsDir, "jujud") +
+ Cmd: path.Join(toolsDir, "jujud") +
     " machine" +
     " --data-dir " + utils.ShQuote(dataDir) +
     " --machine-id " + machineId +

Index: utils/file.go
=== modified file 'utils/file.go'
--- utils/file.go 2013-08-28 20:37:53 +0000
+++ utils/file.go 201...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/cloudinit.go'
2--- environs/cloudinit.go 2013-09-16 22:02:24 +0000
3+++ environs/cloudinit.go 2013-09-18 01:29:18 +0000
4@@ -126,6 +126,7 @@
5 return nil, err
6 }
7 data, err := cloudcfg.Render()
8+ logger.Tracef("Generated cloud init:\n%s", string(data))
9 if err != nil {
10 return nil, err
11 }
12
13=== modified file 'environs/cloudinit/cloudinit.go'
14--- environs/cloudinit/cloudinit.go 2013-09-16 22:04:09 +0000
15+++ environs/cloudinit/cloudinit.go 2013-09-18 01:29:18 +0000
16@@ -6,7 +6,7 @@
17 import (
18 "encoding/base64"
19 "fmt"
20- "path/filepath"
21+ "path"
22
23 "launchpad.net/goyaml"
24
25@@ -222,7 +222,7 @@
26 }
27
28 func (cfg *MachineConfig) dataFile(name string) string {
29- return filepath.Join(cfg.DataDir, name)
30+ return path.Join(cfg.DataDir, name)
31 }
32
33 func (cfg *MachineConfig) agentConfig(tag string) (agent.Config, error) {
34@@ -292,7 +292,7 @@
35 }
36
37 func (cfg *MachineConfig) addMongoToBoot(c *cloudinit.Config) error {
38- dbDir := filepath.Join(cfg.DataDir, "db")
39+ dbDir := path.Join(cfg.DataDir, "db")
40 c.AddScripts(
41 "mkdir -p "+dbDir+"/journal",
42 "chmod 0700 "+dbDir,
43@@ -315,8 +315,8 @@
44 // to use as a directory for storing the tools executables in
45 // by using the last element stripped of its extension.
46 func versionDir(toolsURL string) string {
47- name := filepath.Base(toolsURL)
48- ext := filepath.Ext(name)
49+ name := path.Base(toolsURL)
50+ ext := path.Ext(name)
51 return name[:len(name)-len(ext)]
52 }
53
54
55=== modified file 'scripts/win-installer/setup.iss'
56--- scripts/win-installer/setup.iss 2013-08-30 19:36:39 +0000
57+++ scripts/win-installer/setup.iss 2013-09-18 01:29:18 +0000
58@@ -2,7 +2,7 @@
59 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
60
61 #define MyAppName "Juju"
62-#define MyAppVersion "1.13.2"
63+#define MyAppVersion "1.15.0"
64 #define MyAppPublisher "Canonical, Ltd"
65 #define MyAppURL "http://juju.ubuntu.com/"
66 #define MyAppExeName "juju.exe"
67
68=== modified file 'upstart/service.go'
69--- upstart/service.go 2013-09-16 22:02:24 +0000
70+++ upstart/service.go 2013-09-18 01:29:18 +0000
71@@ -5,7 +5,7 @@
72
73 import (
74 "fmt"
75- "path/filepath"
76+ "path"
77
78 "launchpad.net/juju-core/utils"
79 )
80@@ -17,7 +17,7 @@
81
82 // MongoUpstartService returns the upstart config for the mongo state service.
83 func MongoUpstartService(name, dataDir, dbDir string, port int) *Conf {
84- keyFile := filepath.Join(dataDir, "server.pem")
85+ keyFile := path.Join(dataDir, "server.pem")
86 svc := NewService(name)
87 return &Conf{
88 Service: *svc,
89@@ -44,7 +44,7 @@
90 // based on the tag and machineId passed in.
91 func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId string, env map[string]string) *Conf {
92 svc := NewService(name)
93- logFile := filepath.Join(logDir, tag+".log")
94+ logFile := path.Join(logDir, tag+".log")
95 // The machine agent always starts with debug turned on. The logger worker
96 // will update this to the system logging environment as soon as it starts.
97 return &Conf{
98@@ -53,7 +53,7 @@
99 Limit: map[string]string{
100 "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
101 },
102- Cmd: filepath.Join(toolsDir, "jujud") +
103+ Cmd: path.Join(toolsDir, "jujud") +
104 " machine" +
105 " --data-dir " + utils.ShQuote(dataDir) +
106 " --machine-id " + machineId +
107
108=== modified file 'utils/file.go'
109--- utils/file.go 2013-08-28 20:37:53 +0000
110+++ utils/file.go 2013-09-18 01:29:18 +0000
111@@ -4,6 +4,7 @@
112 package utils
113
114 import (
115+ "path"
116 "path/filepath"
117 "strings"
118
119@@ -18,3 +19,10 @@
120 }
121 return filepath.Clean(dir)
122 }
123+
124+// JoinServerPath joins any number of path elements into a single path, adding
125+// a path separator (based on the current juju server OS) if necessary. The
126+// result is Cleaned; in particular, all empty strings are ignored.
127+func JoinServerPath(elem ...string) string {
128+ return path.Join(elem...)
129+}

Subscribers

People subscribed via source and target branches

to status/vote changes: