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
=== modified file 'environs/cloudinit.go'
--- environs/cloudinit.go 2013-09-16 22:02:24 +0000
+++ environs/cloudinit.go 2013-09-18 01:29:18 +0000
@@ -126,6 +126,7 @@
126 return nil, err126 return nil, err
127 }127 }
128 data, err := cloudcfg.Render()128 data, err := cloudcfg.Render()
129 logger.Tracef("Generated cloud init:\n%s", string(data))
129 if err != nil {130 if err != nil {
130 return nil, err131 return nil, err
131 }132 }
132133
=== modified file 'environs/cloudinit/cloudinit.go'
--- environs/cloudinit/cloudinit.go 2013-09-16 22:04:09 +0000
+++ environs/cloudinit/cloudinit.go 2013-09-18 01:29:18 +0000
@@ -6,7 +6,7 @@
6import (6import (
7 "encoding/base64"7 "encoding/base64"
8 "fmt"8 "fmt"
9 "path/filepath"9 "path"
1010
11 "launchpad.net/goyaml"11 "launchpad.net/goyaml"
1212
@@ -222,7 +222,7 @@
222}222}
223223
224func (cfg *MachineConfig) dataFile(name string) string {224func (cfg *MachineConfig) dataFile(name string) string {
225 return filepath.Join(cfg.DataDir, name)225 return path.Join(cfg.DataDir, name)
226}226}
227227
228func (cfg *MachineConfig) agentConfig(tag string) (agent.Config, error) {228func (cfg *MachineConfig) agentConfig(tag string) (agent.Config, error) {
@@ -292,7 +292,7 @@
292}292}
293293
294func (cfg *MachineConfig) addMongoToBoot(c *cloudinit.Config) error {294func (cfg *MachineConfig) addMongoToBoot(c *cloudinit.Config) error {
295 dbDir := filepath.Join(cfg.DataDir, "db")295 dbDir := path.Join(cfg.DataDir, "db")
296 c.AddScripts(296 c.AddScripts(
297 "mkdir -p "+dbDir+"/journal",297 "mkdir -p "+dbDir+"/journal",
298 "chmod 0700 "+dbDir,298 "chmod 0700 "+dbDir,
@@ -315,8 +315,8 @@
315// to use as a directory for storing the tools executables in315// to use as a directory for storing the tools executables in
316// by using the last element stripped of its extension.316// by using the last element stripped of its extension.
317func versionDir(toolsURL string) string {317func versionDir(toolsURL string) string {
318 name := filepath.Base(toolsURL)318 name := path.Base(toolsURL)
319 ext := filepath.Ext(name)319 ext := path.Ext(name)
320 return name[:len(name)-len(ext)]320 return name[:len(name)-len(ext)]
321}321}
322322
323323
=== modified file 'scripts/win-installer/setup.iss'
--- scripts/win-installer/setup.iss 2013-08-30 19:36:39 +0000
+++ scripts/win-installer/setup.iss 2013-09-18 01:29:18 +0000
@@ -2,7 +2,7 @@
2; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!2; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33
4#define MyAppName "Juju"4#define MyAppName "Juju"
5#define MyAppVersion "1.13.2"5#define MyAppVersion "1.15.0"
6#define MyAppPublisher "Canonical, Ltd"6#define MyAppPublisher "Canonical, Ltd"
7#define MyAppURL "http://juju.ubuntu.com/"7#define MyAppURL "http://juju.ubuntu.com/"
8#define MyAppExeName "juju.exe"8#define MyAppExeName "juju.exe"
99
=== modified file 'upstart/service.go'
--- upstart/service.go 2013-09-16 22:02:24 +0000
+++ upstart/service.go 2013-09-18 01:29:18 +0000
@@ -5,7 +5,7 @@
55
6import (6import (
7 "fmt"7 "fmt"
8 "path/filepath"8 "path"
99
10 "launchpad.net/juju-core/utils"10 "launchpad.net/juju-core/utils"
11)11)
@@ -17,7 +17,7 @@
1717
18// MongoUpstartService returns the upstart config for the mongo state service.18// MongoUpstartService returns the upstart config for the mongo state service.
19func MongoUpstartService(name, dataDir, dbDir string, port int) *Conf {19func MongoUpstartService(name, dataDir, dbDir string, port int) *Conf {
20 keyFile := filepath.Join(dataDir, "server.pem")20 keyFile := path.Join(dataDir, "server.pem")
21 svc := NewService(name)21 svc := NewService(name)
22 return &Conf{22 return &Conf{
23 Service: *svc,23 Service: *svc,
@@ -44,7 +44,7 @@
44// based on the tag and machineId passed in.44// based on the tag and machineId passed in.
45func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId string, env map[string]string) *Conf {45func MachineAgentUpstartService(name, toolsDir, dataDir, logDir, tag, machineId string, env map[string]string) *Conf {
46 svc := NewService(name)46 svc := NewService(name)
47 logFile := filepath.Join(logDir, tag+".log")47 logFile := path.Join(logDir, tag+".log")
48 // The machine agent always starts with debug turned on. The logger worker48 // The machine agent always starts with debug turned on. The logger worker
49 // will update this to the system logging environment as soon as it starts.49 // will update this to the system logging environment as soon as it starts.
50 return &Conf{50 return &Conf{
@@ -53,7 +53,7 @@
53 Limit: map[string]string{53 Limit: map[string]string{
54 "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),54 "nofile": fmt.Sprintf("%d %d", maxAgentFiles, maxAgentFiles),
55 },55 },
56 Cmd: filepath.Join(toolsDir, "jujud") +56 Cmd: path.Join(toolsDir, "jujud") +
57 " machine" +57 " machine" +
58 " --data-dir " + utils.ShQuote(dataDir) +58 " --data-dir " + utils.ShQuote(dataDir) +
59 " --machine-id " + machineId +59 " --machine-id " + machineId +
6060
=== modified file 'utils/file.go'
--- utils/file.go 2013-08-28 20:37:53 +0000
+++ utils/file.go 2013-09-18 01:29:18 +0000
@@ -4,6 +4,7 @@
4package utils4package utils
55
6import (6import (
7 "path"
7 "path/filepath"8 "path/filepath"
8 "strings"9 "strings"
910
@@ -18,3 +19,10 @@
18 }19 }
19 return filepath.Clean(dir)20 return filepath.Clean(dir)
20}21}
22
23// JoinServerPath joins any number of path elements into a single path, adding
24// a path separator (based on the current juju server OS) if necessary. The
25// result is Cleaned; in particular, all empty strings are ignored.
26func JoinServerPath(elem ...string) string {
27 return path.Join(elem...)
28}

Subscribers

People subscribed via source and target branches

to status/vote changes: