Merge lp:~thumper/juju-core/014-fix-windows-build into lp:juju-core/1.14

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 1747
Proposed branch: lp:~thumper/juju-core/014-fix-windows-build
Merge into: lp:juju-core/1.14
Diff against target: 128 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/014-fix-windows-build
Reviewer Review Type Date Requested Status
Nate Finch (community) Approve
Review via email: mp+186179@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.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Nate Finch (natefinch) wrote :

LGTM

review: Approve

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-08-22 07:42:43 +0000
3+++ environs/cloudinit.go 2013-09-17 23:14:23 +0000
4@@ -125,6 +125,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-17 12:51:56 +0000
15+++ environs/cloudinit/cloudinit.go 2013-09-17 23:14:23 +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@@ -228,7 +228,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@@ -297,7 +297,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 // Otherwise we get three files with 100M+ each, which takes time.
43@@ -319,8 +319,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-09-17 12:51:19 +0000
57+++ scripts/win-installer/setup.iss 2013-09-17 23:14:23 +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.14.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-07-30 22:21:47 +0000
70+++ upstart/service.go 2013-09-17 23:14:23 +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,14 +44,14 @@
90 // based on the tag and machineId passed in.
91 func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId, logConfig 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 return &Conf{
96 Service: *svc,
97 Desc: fmt.Sprintf("juju %s agent", tag),
98 Limit: map[string]string{
99 "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
100 },
101- Cmd: filepath.Join(toolsDir, "jujud") +
102+ Cmd: path.Join(toolsDir, "jujud") +
103 " machine" +
104 " --log-file " + utils.ShQuote(logFile) +
105 " --data-dir " + utils.ShQuote(dataDir) +
106
107=== modified file 'utils/file.go'
108--- utils/file.go 2013-09-17 12:51:19 +0000
109+++ utils/file.go 2013-09-17 23:14:23 +0000
110@@ -4,6 +4,7 @@
111 package utils
112
113 import (
114+ "path"
115 "path/filepath"
116 "strings"
117
118@@ -18,3 +19,10 @@
119 }
120 return filepath.Clean(dir)
121 }
122+
123+// JoinServerPath joins any number of path elements into a single path, adding
124+// a path separator (based on the current juju server OS) if necessary. The
125+// result is Cleaned; in particular, all empty strings are ignored.
126+func JoinServerPath(elem ...string) string {
127+ return path.Join(elem...)
128+}

Subscribers

People subscribed via source and target branches

to all changes: