vagrant-bosh 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efc32c9ec7924465b7ecb3ddeef08cd47e6d1eb4
4
- data.tar.gz: 9560d462714efd859191da51ee22c37ed4d5cb67
3
+ metadata.gz: 831ea9bc4698d6a0dea969a338e2d48bfc936306
4
+ data.tar.gz: d5454ec89149ebd6779f72b7d27226284bdd1bde
5
5
  SHA512:
6
- metadata.gz: b84f34a4a5ad470c17c3528be1335cd254b674dbcc24da43e74077afdcf2fc2c67a0dbf18e64ddef73c1931e699ebc3e6bd2a18659ce025bc10807ab4fd820b4
7
- data.tar.gz: c5abbab55e5ca3bf253b53f4d12bbce3c5c3a9e01815e7543b0e4ca253e5b63342a73b1e39b3fa360220503c369231cb4dc4ab8fc44fc379e901b1ee404e6569
6
+ metadata.gz: d34fbdcc2ef35e1174997bb0b98800d14493a2a2a308d50a728154be225fe6edc6b6421d1f16ceb7a258195e2f6d956257cbca6af8225ba3f6a0a29430d5e3b9
7
+ data.tar.gz: d56779c9cca2243e903c21690c1c7a379ed4d663b850554a03aabaf352f646de4aa99c5b0c8797621b92d63498bc7deb5d5a6dd1d8279e0cff67a84bac038055
data/.gitmodules CHANGED
@@ -1,6 +1,6 @@
1
1
  [submodule "bosh"]
2
2
  path = bosh
3
3
  url = https://github.com/cloudfoundry/bosh.git
4
- [submodule "go/src/github.com/fraenkel/candiedyaml"]
5
- path = go/src/github.com/fraenkel/candiedyaml
6
- url = https://github.com/fraenkel/candiedyaml.git
4
+ [submodule "go/src/github.com/cloudfoundry-incubator/candiedyaml"]
5
+ path = go/src/github.com/cloudfoundry-incubator/candiedyaml
6
+ url = https://github.com/cloudfoundry-incubator/candiedyaml.git
data/README.md CHANGED
@@ -5,14 +5,17 @@ BOSH provisioner allows to provision guest VM by specifying regular BOSH deploym
5
5
 
6
6
  ### Usage
7
7
 
8
- 1. Add new VM provision section to your `Vagrantfile`. For example:
8
+ 1. `vagrant plugin install vagrant-bosh`
9
+
10
+ 2. Add new VM provision section to your `Vagrantfile`. For example:
9
11
 
10
12
  ```
11
13
  Vagrant.configure("2") do |config|
12
14
  config.vm.box = "precise64"
13
15
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"
14
16
 
15
- config.vm.network "forwarded_port", guest: 25555, host: 25555 # for BOSH Director API
17
+ # Example port forward for example-bosh-manifest.yml
18
+ config.vm.network "forwarded_port", guest: 25555, host: 25555 # BOSH Director API
16
19
 
17
20
  config.vm.provider "virtualbox" do |v|
18
21
  v.memory = 4096
@@ -26,10 +29,10 @@ Vagrant.configure("2") do |config|
26
29
  end
27
30
  ```
28
31
 
29
- 2. Create a deployment manifest and specify it via `c.manifest` attribute.
32
+ 3. Create a deployment manifest and specify it via `c.manifest` attribute.
30
33
  See `dev/example-bosh-manifest.yml` for an example deployment manifest used to deploy BOSH Director.
31
34
 
32
- 3. Run `vagrant provision` to provision guest VM
35
+ 4. Run `vagrant provision` to provision guest VM
33
36
  (DEBUG=1 environment variable will trigger live verbose output).
34
37
 
35
38
 
@@ -62,11 +65,7 @@ end
62
65
  ```
63
66
  git submodule update --recursive --init
64
67
 
65
- # Provisioner uses BOSH Agent (Go) libraries (e.g. Blobstore, CmdRunner)
66
- export GOPATH=$PWD/go:$PWD/bosh/go_agent
67
-
68
- go/bin/test
69
- go/bin/build-linux-amd64
68
+ go/bin/test # or go/bin/build-linux-amd64
70
69
 
71
70
  # Spin up development Vagrant box with lib/ acting as BOSH provisioner
72
71
  ( cd dev/ && vagrant up )
@@ -6,6 +6,10 @@ import (
6
6
  bosherr "bosh/errors"
7
7
  )
8
8
 
9
+ var (
10
+ DefaultWatchTime = WatchTime{0, 60000}
11
+ )
12
+
9
13
  func (d Deployment) InstanceWatchTime(job Job, i int) WatchTime {
10
14
  var canaries int
11
15
 
@@ -19,7 +23,7 @@ func (d Deployment) InstanceWatchTime(job Job, i int) WatchTime {
19
23
  return d.CanaryWatchTime(job)
20
24
  }
21
25
 
22
- return d.CanaryWatchTime(job)
26
+ return d.UpdateWatchTime(job)
23
27
  }
24
28
 
25
29
  func (d Deployment) CanaryWatchTime(job Job) WatchTime {
@@ -7,7 +7,7 @@ import (
7
7
 
8
8
  bosherr "bosh/errors"
9
9
  boshsys "bosh/system"
10
- "github.com/fraenkel/candiedyaml"
10
+ "github.com/cloudfoundry-incubator/candiedyaml"
11
11
  )
12
12
 
13
13
  type Manifest struct {
@@ -9,10 +9,6 @@ import (
9
9
 
10
10
  type WatchTime [2]int
11
11
 
12
- var (
13
- DefaultWatchTime = WatchTime{0, 0}
14
- )
15
-
16
12
  func NewWatchTimeFromString(str string) (WatchTime, error) {
17
13
  var watchTime WatchTime
18
14
 
@@ -88,6 +88,57 @@ var _ = Describe("RenderProperties", func() {
88
88
  })
89
89
  })
90
90
 
91
+ Context("when job specifies an empty string default for a nested property", func() {
92
+ BeforeEach(func() {
93
+ job = bpreljob.Job{
94
+ Properties: []bpreljob.Property{
95
+ bpreljob.Property{
96
+ Name: "prop.nest-prop",
97
+ Default: "",
98
+ },
99
+ },
100
+ }
101
+ })
102
+
103
+ Context("when instance specifies nested property", func() {
104
+ BeforeEach(func() {
105
+ instance = bpdep.Instance{
106
+ Properties: map[string]interface{}{
107
+ "prop": map[string]interface{}{
108
+ "nest-prop": "instance-val",
109
+ },
110
+ },
111
+ }
112
+ })
113
+
114
+ It("returns map with property value from instance", func() {
115
+ Expect(props.AsMap()).To(Equal(map[string]interface{}{
116
+ "prop": map[string]interface{}{
117
+ "nest-prop": "instance-val",
118
+ },
119
+ }))
120
+ })
121
+ })
122
+
123
+ Context("when instance does not specify nested property", func() {
124
+ BeforeEach(func() {
125
+ instance = bpdep.Instance{
126
+ Properties: map[string]interface{}{
127
+ "prop": map[string]interface{}{},
128
+ },
129
+ }
130
+ })
131
+
132
+ It("returns map with default property from job", func() {
133
+ Expect(props.AsMap()).To(Equal(map[string]interface{}{
134
+ "prop": map[string]interface{}{
135
+ "nest-prop": "",
136
+ },
137
+ }))
138
+ })
139
+ })
140
+ })
141
+
91
142
  Context("when job does not specify a default (nil) for a nested property", func() {
92
143
  BeforeEach(func() {
93
144
  job = bpreljob.Job{
@@ -16,7 +16,9 @@ import (
16
16
  var _ = Describe("Waiter", func() {
17
17
  var (
18
18
  sleptTimes []time.Duration
19
+ sleepFunc func(d time.Duration)
19
20
  agentClient *fakebpagclient.FakeClient
21
+ logger boshlog.Logger
20
22
  waiter Waiter
21
23
  )
22
24
 
@@ -27,10 +29,10 @@ var _ = Describe("Waiter", func() {
27
29
 
28
30
  BeforeEach(func() {
29
31
  sleptTimes = []time.Duration{}
30
- sleepFunc := func(d time.Duration) { sleptTimes = append(sleptTimes, d) }
32
+ sleepFunc = func(d time.Duration) { sleptTimes = append(sleptTimes, d) }
31
33
 
32
34
  agentClient = &fakebpagclient.FakeClient{}
33
- logger := boshlog.NewLogger(boshlog.LevelNone)
35
+ logger = boshlog.NewLogger(boshlog.LevelNone)
34
36
  waiter = NewWaiter(5000, 14000, sleepFunc, agentClient, logger)
35
37
  })
36
38
 
@@ -99,5 +101,47 @@ var _ = Describe("Waiter", func() {
99
101
  Expect(sleptTimes).To(Equal([]time.Duration{firstTimeGap}))
100
102
  })
101
103
  })
104
+
105
+ Context("when watch time is starts with a 0", func() {
106
+ BeforeEach(func() {
107
+ waiter = NewWaiter(0, 14000, sleepFunc, agentClient, logger)
108
+ })
109
+
110
+ BeforeEach(func() {
111
+ agentClient.GetStateStates = []boshaction.GetStateV1ApplySpec{
112
+ boshaction.GetStateV1ApplySpec{JobState: "not-running"},
113
+ boshaction.GetStateV1ApplySpec{JobState: "running"},
114
+ }
115
+ })
116
+
117
+ It("immediately checks if instance is running", func() {
118
+ err := waiter.Wait()
119
+ Expect(err).ToNot(HaveOccurred())
120
+
121
+ Expect(sleptTimes).To(Equal([]time.Duration{
122
+ 0 * time.Millisecond,
123
+ subsequentTimeGap,
124
+ }))
125
+ })
126
+ })
127
+
128
+ Context("when watch time ends with a 0", func() {
129
+ BeforeEach(func() {
130
+ waiter = NewWaiter(0, 0, sleepFunc, agentClient, logger)
131
+ })
132
+
133
+ BeforeEach(func() {
134
+ agentClient.GetStateStates = []boshaction.GetStateV1ApplySpec{
135
+ boshaction.GetStateV1ApplySpec{JobState: "running"},
136
+ }
137
+ })
138
+
139
+ It("immediately checks if instance is running", func() {
140
+ err := waiter.Wait()
141
+ Expect(err).ToNot(HaveOccurred())
142
+
143
+ Expect(sleptTimes).To(Equal([]time.Duration{0 * time.Millisecond}))
144
+ })
145
+ })
102
146
  })
103
147
  })
@@ -4,7 +4,7 @@ package manifest
4
4
  import (
5
5
  bosherr "bosh/errors"
6
6
  boshsys "bosh/system"
7
- "github.com/fraenkel/candiedyaml"
7
+ "github.com/cloudfoundry-incubator/candiedyaml"
8
8
  )
9
9
 
10
10
  type Manifest struct {
@@ -38,5 +38,22 @@ properties:
38
38
  }))
39
39
  }
40
40
  })
41
+
42
+ It("returns manifest with property definiton default that is an empty string", func() {
43
+ manifestBytes := []byte(`
44
+ properties:
45
+ key:
46
+ default: ""
47
+ `)
48
+
49
+ manifest, err := NewManifestFromBytes(manifestBytes)
50
+ Expect(err).ToNot(HaveOccurred())
51
+
52
+ Expect(manifest.Job.PropertyMappings).To(HaveLen(1))
53
+
54
+ for _, propDef := range manifest.Job.PropertyMappings {
55
+ Expect(propDef.Default).To(Equal(""))
56
+ }
57
+ })
41
58
  })
42
59
  })
@@ -4,7 +4,7 @@ package manifest
4
4
  import (
5
5
  bosherr "bosh/errors"
6
6
  boshsys "bosh/system"
7
- "github.com/fraenkel/candiedyaml"
7
+ "github.com/cloudfoundry-incubator/candiedyaml"
8
8
  )
9
9
 
10
10
  type Manifest struct {
Binary file
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantBosh
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
data/vagrant-bosh.gemspec CHANGED
@@ -1,9 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
+ require "vagrant-bosh/version"
5
+
4
6
  Gem::Specification.new do |s|
5
7
  s.name = "vagrant-bosh"
6
- s.version = "0.0.1"
8
+ s.version = VagrantPlugins::VagrantBosh::VERSION
7
9
 
8
10
  s.homepage = "https://github.com/cppforlife/vagrant-bosh"
9
11
  s.summary = %q{Vagrant BOSH provisioner plugin.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-bosh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Kalinin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-19 00:00:00.000000000 Z
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BOSH provisioner allows to provision guest VM by specifying regular BOSH
14
14
  deployment manifest.