bosh-gen 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +31 -0
- data/README.md +2 -2
- data/bosh-gen.gemspec +2 -1
- data/lib/bosh/gen/cli.rb +9 -3
- data/lib/bosh/gen/generators/deployment_manifest_generator.rb +24 -8
- data/lib/bosh/gen/generators/job_generator.rb +1 -1
- data/lib/bosh/gen/generators/job_generator/templates/examples/{%job_name%_simple/default.yml → %job_name%.yml.tt} +0 -0
- data/lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/config/.gitkeep +0 -0
- data/lib/bosh/gen/generators/micro_job_generator.rb +13 -8
- data/lib/bosh/gen/generators/new_release_generator.rb +70 -8
- data/lib/bosh/gen/generators/new_release_generator/templates/README.md.tt +3 -3
- data/lib/bosh/gen/generators/package_generator.rb +4 -9
- data/lib/bosh/gen/models/deployment_manifest.rb +4 -3
- data/lib/bosh/gen/version.rb +1 -1
- data/spec/fixtures/deployment_manifests/2_jobs_1_ip_8196_disk.yml +1 -1
- data/spec/fixtures/deployment_manifests/2_jobs_2_ips_no_disk.yml +1 -1
- data/spec/fixtures/releases/bosh-sample-release/jobs/mysql/spec +5 -0
- data/spec/generators/deployment_manifest_generator_spec.rb +33 -0
- data/spec/generators/generator_spec_helper.rb +12 -0
- data/spec/generators/jobs/webapp_job_generator_spec.rb +1 -1
- data/spec/models/deployment_manifest_spec.rb +2 -2
- metadata +28 -9
data/ChangeLog.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## v0.11.0
|
4
|
+
|
5
|
+
Added:
|
6
|
+
|
7
|
+
* New blobstore provider: OpenStack Swift [thanks Ferran!]
|
8
|
+
* `package` --src/-s specifies already internal sources/blobs; example: --src 'myapp/**/*'
|
9
|
+
* `job` includes an empty `templates/config` to suggest where config templates should go
|
10
|
+
|
11
|
+
Improved:
|
12
|
+
|
13
|
+
* `new` - --s3 flag looks for `~/.bosh_s3_credentials` file for default AWS S3 credentials
|
14
|
+
|
15
|
+
For common defaults on s3 blobstore credentials, create an
|
16
|
+
`~/.bosh_s3_credentials` file that looks like:
|
17
|
+
|
18
|
+
``` yaml
|
19
|
+
readonly_access_key: XXX
|
20
|
+
readonly_secret_access_key: XXX
|
21
|
+
readwrite_access_key: XXX
|
22
|
+
readwrite_secret_access_key: XXX
|
23
|
+
```
|
24
|
+
|
25
|
+
Other changes:
|
26
|
+
|
27
|
+
* Using 1.0 release candidate for bosh_cli
|
28
|
+
* `micro` - fix accidental gitignore of prepare/prepare_spec
|
29
|
+
* `new` - `bosh-gen new project-boshrelease`; name is "project", initial dev name is "project-dev"
|
30
|
+
* `manifest` - default stemcell is bosh-stemcell-0.6.4
|
31
|
+
* `manifest` - creates `#{name}.yml` instead of `#{name}/manifest.yml`
|
32
|
+
* `job` - example file not in a subfolder anymore
|
33
|
+
|
3
34
|
## v0.10.0
|
4
35
|
|
5
36
|
Added:
|
data/README.md
CHANGED
@@ -21,12 +21,13 @@ Or install it yourself as:
|
|
21
21
|
```
|
22
22
|
$ bosh-gen new my-new-project --s3
|
23
23
|
$ bosh-gen new my-new-project --atmos
|
24
|
+
$ bosh-gen new my-new-project --swift
|
24
25
|
$ bosh-gen new my-new-project # local blobstore with a warning
|
25
26
|
|
26
27
|
$ cd my-new-project
|
27
28
|
```
|
28
29
|
|
29
|
-
**NEXT:** Edit `config/final.yml` with your S3 or
|
30
|
+
**NEXT:** Edit `config/final.yml` with your S3, ATMOS or Swift credentials
|
30
31
|
|
31
32
|
```
|
32
33
|
$ bosh create release
|
@@ -117,7 +118,6 @@ In `packages/java7/spec`, rename it to `java7`.
|
|
117
118
|
```
|
118
119
|
$ bosh-gen package cassandra -d java7 -f ~/Downloads/apache-cassandra-1.0.11-bin.tar.gz
|
119
120
|
create packages/cassandra/packaging
|
120
|
-
create packages/cassandra/pre_packaging
|
121
121
|
create blobs/cassandra/apache-cassandra-1.0.11-bin.tar.gz
|
122
122
|
create packages/cassandra/spec
|
123
123
|
```
|
data/bosh-gen.gemspec
CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Bosh::Gen::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency "thor"
|
19
|
-
gem.add_dependency "bosh_cli"
|
19
|
+
gem.add_dependency "bosh_cli", "~> 1.0.rc1"
|
20
|
+
gem.add_dependency "bosh_common", "~> 0.5.1"
|
20
21
|
|
21
22
|
gem.add_development_dependency "rake"
|
22
23
|
gem.add_development_dependency "minitest", "~> 2.12"
|
data/lib/bosh/gen/cli.rb
CHANGED
@@ -17,8 +17,11 @@ module Bosh
|
|
17
17
|
:desc => "Use AWS S3 bucket for blobstore"
|
18
18
|
method_option :atmos, :type => :boolean,
|
19
19
|
:desc => "Use EMC ATMOS for blobstore"
|
20
|
+
method_option :swift, :type => :boolean,
|
21
|
+
:desc => "Use OpenStack Swift for blobstore"
|
20
22
|
def new(path)
|
21
|
-
flags = { :aws => options["s3"], :atmos => options["atmos"]
|
23
|
+
flags = { :aws => options["s3"], :atmos => options["atmos"],
|
24
|
+
:swift => options["swift"]}
|
22
25
|
|
23
26
|
require 'bosh/gen/generators/new_release_generator'
|
24
27
|
Bosh::Gen::Generators::NewReleaseGenerator.start([path, flags])
|
@@ -27,14 +30,17 @@ module Bosh
|
|
27
30
|
desc "package NAME", "Create a new package"
|
28
31
|
method_option :dependencies, :aliases => ['-d'], :type => :array,
|
29
32
|
:desc => "List of package dependencies"
|
30
|
-
method_option :files, :aliases => ['-f'
|
33
|
+
method_option :files, :aliases => ['-f'], :type => :array,
|
31
34
|
:desc => "List of files copy into release"
|
35
|
+
method_option :src, :aliases => ['-s'], :type => :array,
|
36
|
+
:desc => "List of existing sources to use, e.g. --src 'myapp/**/*'"
|
32
37
|
def package(name)
|
33
38
|
dependencies = options[:dependencies] || []
|
34
39
|
files = options[:files] || []
|
40
|
+
sources = options[:src] || []
|
35
41
|
require 'bosh/gen/generators/package_generator'
|
36
42
|
Bosh::Gen::Generators::PackageGenerator.start(
|
37
|
-
[name, dependencies, files])
|
43
|
+
[name, dependencies, files, sources])
|
38
44
|
end
|
39
45
|
|
40
46
|
desc "source NAME", "Downloads a source item into the named project"
|
@@ -1,22 +1,18 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'thor/group'
|
3
|
+
require 'common/properties/property_helper' # bosh_common
|
3
4
|
|
4
5
|
module Bosh::Gen
|
5
6
|
module Generators
|
6
7
|
class DeploymentManifestGenerator < Thor::Group
|
7
8
|
include Thor::Actions
|
9
|
+
include Bosh::Common::PropertyHelper
|
8
10
|
|
9
11
|
argument :name
|
10
12
|
argument :release_path
|
11
13
|
argument :ip_addresses
|
12
14
|
argument :flags, :type => :hash
|
13
15
|
|
14
|
-
def create_root
|
15
|
-
self.destination_root = File.expand_path(name, destination_root)
|
16
|
-
empty_directory '.'
|
17
|
-
FileUtils.cd(destination_root) unless options[:pretend]
|
18
|
-
end
|
19
|
-
|
20
16
|
def check_release_path_is_release
|
21
17
|
unless File.exist?(release_path)
|
22
18
|
raise Thor::Error.new("target path '#{release_path}' doesn't exist")
|
@@ -38,7 +34,8 @@ module Bosh::Gen
|
|
38
34
|
cloud_properties["static_ips"] = ip_addresses
|
39
35
|
director_uuid = Bosh::Gen::Models::BoshConfig.new.target_uuid
|
40
36
|
manifest = Bosh::Gen::Models::DeploymentManifest.new(
|
41
|
-
name, director_uuid,
|
37
|
+
name, director_uuid,
|
38
|
+
release_properties, cloud_properties, default_properties)
|
42
39
|
manifest.jobs = job_manifests
|
43
40
|
create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]
|
44
41
|
end
|
@@ -54,7 +51,7 @@ module Bosh::Gen
|
|
54
51
|
|
55
52
|
# Whether +name+ contains .yml suffix or nor, returns a .yml filename for manifest to be generated
|
56
53
|
def manifest_file_name
|
57
|
-
basename = "
|
54
|
+
basename = "#{name}.yml"
|
58
55
|
end
|
59
56
|
|
60
57
|
def job_manifests
|
@@ -75,6 +72,25 @@ module Bosh::Gen
|
|
75
72
|
def release_properties
|
76
73
|
release_detector.latest_dev_release_properties
|
77
74
|
end
|
75
|
+
|
76
|
+
# Default properties for manifest, based on each job's spec's properties hash, if present
|
77
|
+
# For example, a job's spec may include something like:
|
78
|
+
# properties:
|
79
|
+
# mysql.password:
|
80
|
+
# default: mypassword
|
81
|
+
# description: Password for mysql server
|
82
|
+
def default_properties
|
83
|
+
properties = {}
|
84
|
+
detect_jobs.each do |job_name|
|
85
|
+
spec = YAML.load_file(File.join(release_path, "jobs", job_name, "spec"))
|
86
|
+
if spec_properties = spec["properties"]
|
87
|
+
spec_properties.each_pair do |name, definition|
|
88
|
+
copy_property(properties, spec_properties, name, definition["default"])
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
properties
|
93
|
+
end
|
78
94
|
end
|
79
95
|
end
|
80
96
|
end
|
File without changes
|
File without changes
|
@@ -17,27 +17,27 @@ module Bosh::Gen
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_job
|
20
|
-
directory "jobs/micro"
|
21
|
-
chmod "jobs/
|
20
|
+
directory "jobs/micro", "jobs/#{job_name}"
|
21
|
+
chmod "jobs/#{job_name}/prepare", 0755
|
22
22
|
end
|
23
23
|
|
24
24
|
def prepare_spec_defaults_all_jobs
|
25
|
-
jobs = Dir[File.expand_path("jobs/*")].map {|job| File.basename(job) } - [
|
25
|
+
jobs = Dir[File.expand_path("jobs/*")].map {|job| File.basename(job) } - [job_name]
|
26
26
|
spec = { "jobs" => jobs }
|
27
|
-
create_file "jobs/
|
27
|
+
create_file "jobs/#{job_name}/prepare_spec", YAML.dump(spec)
|
28
28
|
end
|
29
29
|
|
30
30
|
def gitignore
|
31
31
|
append_file ".gitignore", <<-IGNORE.gsub(/^\s{8}/, '')
|
32
|
-
jobs/
|
33
|
-
jobs/
|
34
|
-
jobs/
|
32
|
+
jobs/#{job_name}/monit
|
33
|
+
jobs/#{job_name}/spec
|
34
|
+
jobs/#{job_name}/templates/
|
35
35
|
IGNORE
|
36
36
|
end
|
37
37
|
|
38
38
|
def readme
|
39
39
|
say ""
|
40
|
-
say "Edit "; say "jobs/
|
40
|
+
say "Edit "; say "jobs/#{job_name}/prepare_spec ", :yellow
|
41
41
|
say "with ordered list of jobs to include"
|
42
42
|
say "in micro job. The order of jobs implicitly specifies the order in"
|
43
43
|
say "which they are started."
|
@@ -45,6 +45,11 @@ module Bosh::Gen
|
|
45
45
|
say ""
|
46
46
|
end
|
47
47
|
|
48
|
+
private
|
49
|
+
# May be an argument for the generator in future
|
50
|
+
def job_name
|
51
|
+
"micro"
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -39,7 +39,7 @@ module Bosh::Gen
|
|
39
39
|
|
40
40
|
# TODO - support other blobstores
|
41
41
|
def local_blobstore
|
42
|
-
config_dev = { "dev_name" =>
|
42
|
+
config_dev = { "dev_name" => "#{project_name}-dev" }
|
43
43
|
create_file "config/dev.yml", YAML.dump(config_dev)
|
44
44
|
|
45
45
|
case blobstore_type
|
@@ -56,8 +56,8 @@ module Bosh::Gen
|
|
56
56
|
config_private = {
|
57
57
|
"blobstore" => {
|
58
58
|
"s3" => {
|
59
|
-
"access_key_id" =>
|
60
|
-
"secret_access_key" =>
|
59
|
+
"access_key_id" => readwrite_aws_access_key,
|
60
|
+
"secret_access_key" => readwrite_aws_secret_access_key
|
61
61
|
}
|
62
62
|
}
|
63
63
|
}
|
@@ -69,6 +69,22 @@ module Bosh::Gen
|
|
69
69
|
}
|
70
70
|
}
|
71
71
|
}
|
72
|
+
when :swift
|
73
|
+
config_private = {
|
74
|
+
"blobstore" => {
|
75
|
+
"swift" => {
|
76
|
+
"rackspace" => {
|
77
|
+
"rackspace_username" => "USERNAME",
|
78
|
+
"rackspace_api_key" => "API_KEY"
|
79
|
+
},
|
80
|
+
"hp" => {
|
81
|
+
"hp_account_id" => "ACCESS_KEY_ID",
|
82
|
+
"hp_secret_key" => "SECRET_KEY",
|
83
|
+
"hp_tenant_id" => "TENANT_ID"
|
84
|
+
},
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
72
88
|
end
|
73
89
|
create_file "config/private.yml", YAML.dump(config_private)
|
74
90
|
|
@@ -85,8 +101,8 @@ module Bosh::Gen
|
|
85
101
|
"provider" => "s3",
|
86
102
|
"options" => {
|
87
103
|
"bucket_name" => "BOSH",
|
88
|
-
"access_key_id" =>
|
89
|
-
"secret_access_key" =>
|
104
|
+
"access_key_id" => readonly_aws_access_key,
|
105
|
+
"secret_access_key" => readonly_aws_secret_access_key,
|
90
106
|
"encryption_key" => "PERSONAL_RANDOM_KEY",
|
91
107
|
}
|
92
108
|
}
|
@@ -101,6 +117,15 @@ module Bosh::Gen
|
|
101
117
|
}
|
102
118
|
}
|
103
119
|
}
|
120
|
+
when :swift
|
121
|
+
config_final = { "blobstore" => {
|
122
|
+
"provider" => "swift",
|
123
|
+
"options" => {
|
124
|
+
"container_name" => "BOSH",
|
125
|
+
"swift_provider" => "SWIFT_PROVIDER"
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
104
129
|
end
|
105
130
|
|
106
131
|
create_file "config/final.yml", YAML.dump(config_final)
|
@@ -135,13 +160,18 @@ module Bosh::Gen
|
|
135
160
|
|
136
161
|
private
|
137
162
|
|
138
|
-
def
|
139
|
-
|
163
|
+
def project_name
|
164
|
+
@project_name ||= repository_name.gsub(/-(?:boshrelease|release)$/, '')
|
140
165
|
end
|
141
|
-
|
166
|
+
|
167
|
+
def repository_name
|
168
|
+
@repository_name ||= File.basename(app_path)
|
169
|
+
end
|
170
|
+
|
142
171
|
def blobstore_type
|
143
172
|
return :s3 if s3?
|
144
173
|
return :atmos if atmos?
|
174
|
+
return :swift if swift?
|
145
175
|
return :local
|
146
176
|
end
|
147
177
|
|
@@ -153,6 +183,10 @@ module Bosh::Gen
|
|
153
183
|
flags[:atmos]
|
154
184
|
end
|
155
185
|
|
186
|
+
def swift?
|
187
|
+
flags[:swift]
|
188
|
+
end
|
189
|
+
|
156
190
|
# Run a command in git.
|
157
191
|
#
|
158
192
|
# ==== Examples
|
@@ -170,6 +204,34 @@ module Bosh::Gen
|
|
170
204
|
end
|
171
205
|
end
|
172
206
|
end
|
207
|
+
|
208
|
+
def readonly_aws_access_key
|
209
|
+
s3_credentials "readonly_access_key", "READONLY_AWS_ACCESS_KEY"
|
210
|
+
end
|
211
|
+
|
212
|
+
def readonly_aws_secret_access_key
|
213
|
+
s3_credentials "readonly_secret_access_key", "READONLY_AWS_SECRET_ACCESS_KEY"
|
214
|
+
end
|
215
|
+
|
216
|
+
def readwrite_aws_access_key
|
217
|
+
s3_credentials "readwrite_access_key", "READWRITE_AWS_ACCESS_KEY"
|
218
|
+
end
|
219
|
+
|
220
|
+
def readwrite_aws_secret_access_key
|
221
|
+
s3_credentials "readwrite_secret_access_key", "READWRITE_AWS_SECRET_ACCESS_KEY"
|
222
|
+
end
|
223
|
+
|
224
|
+
def s3_credentials(key, default)
|
225
|
+
@s3_credentials ||= begin
|
226
|
+
creds = File.expand_path("~/.bosh_s3_credentials")
|
227
|
+
if File.exist?(creds)
|
228
|
+
YAML.load_file(creds)
|
229
|
+
else
|
230
|
+
{}
|
231
|
+
end
|
232
|
+
end
|
233
|
+
@s3_credentials[key] || default
|
234
|
+
end
|
173
235
|
end
|
174
236
|
end
|
175
237
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# BOSH Release for <%=
|
1
|
+
# BOSH Release for <%= project_name %>
|
2
2
|
|
3
3
|
## Release to your BOSH
|
4
4
|
|
@@ -6,8 +6,8 @@ To create and upload this release to your BOSH:
|
|
6
6
|
|
7
7
|
```
|
8
8
|
bosh target BOSH_URL
|
9
|
-
git clone git@github.com:<%= `whoami`.strip %>/<%=
|
10
|
-
cd <%=
|
9
|
+
git clone git@github.com:<%= `whoami`.strip %>/<%= repository_name %>.git
|
10
|
+
cd <%= repository_name %>
|
11
11
|
bosh create release
|
12
12
|
# blobs are automatically downloaded
|
13
13
|
# name it 'cassandra-dev' or something unique to your bosh
|
@@ -9,6 +9,7 @@ module Bosh::Gen
|
|
9
9
|
argument :name
|
10
10
|
argument :dependencies, :type => :array
|
11
11
|
argument :files, :type => :array
|
12
|
+
argument :existing_sources, :type => :array
|
12
13
|
|
13
14
|
BLOB_FILE_MIN_SIZE=20_000 # files over 20k are blobs
|
14
15
|
|
@@ -68,14 +69,6 @@ module Bosh::Gen
|
|
68
69
|
|
69
70
|
packaging
|
70
71
|
end
|
71
|
-
|
72
|
-
create_file package_dir("pre_packaging") do
|
73
|
-
<<-SHELL.gsub(/^\s{10}/, '')
|
74
|
-
set -e # exit immediately if a simple command exits with a non-zero status
|
75
|
-
set -u # report the usage of uninitialized variables
|
76
|
-
|
77
|
-
SHELL
|
78
|
-
end
|
79
72
|
end
|
80
73
|
|
81
74
|
# Copy the local source files into src or blobs
|
@@ -107,7 +100,9 @@ module Bosh::Gen
|
|
107
100
|
end
|
108
101
|
|
109
102
|
def package_specification
|
110
|
-
src_files =
|
103
|
+
src_files =
|
104
|
+
files.map {|f| "#{name}/#{File.basename(f)}"} + # new blobs
|
105
|
+
existing_sources # existing files/sources, like 'myapp/**/*'
|
111
106
|
config = { "name" => name, "dependencies" => dependencies, "files" => src_files }
|
112
107
|
create_file package_dir("spec"), YAML.dump(config)
|
113
108
|
end
|
@@ -4,11 +4,12 @@ module Bosh::Gen::Models
|
|
4
4
|
class DeploymentManifest
|
5
5
|
attr_reader :manifest
|
6
6
|
|
7
|
-
def initialize(name, director_uuid, release_properties, cloud_properties)
|
7
|
+
def initialize(name, director_uuid, release_properties, cloud_properties, properties)
|
8
8
|
@manifest = {}
|
9
9
|
@cloud_properties = cloud_properties
|
10
|
+
@properties = properties
|
10
11
|
@security_groups = ["default"]
|
11
|
-
@stemcell_version = "0.6.
|
12
|
+
@stemcell_version = "0.6.4"
|
12
13
|
@stemcell = { "name" => "bosh-stemcell", "version" => @stemcell_version }
|
13
14
|
@persistent_disk = cloud_properties.delete("persistent_disk").to_i
|
14
15
|
@static_ips = cloud_properties.delete("static_ips") || []
|
@@ -56,7 +57,7 @@ module Bosh::Gen::Models
|
|
56
57
|
]
|
57
58
|
manifest["resource_pools"].first["persistent_disk"] = @persistent_disk if @persistent_disk > 0
|
58
59
|
manifest["jobs"] = []
|
59
|
-
manifest["properties"] =
|
60
|
+
manifest["properties"] = @properties
|
60
61
|
end
|
61
62
|
|
62
63
|
# Each item of +jobs+ is a hash.
|
data/lib/bosh/gen/version.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "generators/generator_spec_helper"
|
3
|
+
|
4
|
+
# in a tmp folder:
|
5
|
+
# * run generator
|
6
|
+
# * deployment manifest created
|
7
|
+
|
8
|
+
# generates dpeloyment manifest for a target release
|
9
|
+
class DeploymentManifestGeneratorSpec < MiniTest::Spec
|
10
|
+
include GeneratorSpecHelper
|
11
|
+
|
12
|
+
def self.pending(name, &block); end
|
13
|
+
|
14
|
+
def setup
|
15
|
+
setup_universe
|
16
|
+
setup_project_release("bosh-sample-release")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "creates deployment manifest with properties" do
|
20
|
+
release_folder = File.expand_path("../../fixtures/releases/bosh-sample-release", __FILE__)
|
21
|
+
in_home_folder do
|
22
|
+
generate_manifest("wordpress", release_folder)
|
23
|
+
|
24
|
+
File.exist?("wordpress.yml").must_equal(true, "manifest wordpress.yml not created")
|
25
|
+
|
26
|
+
manifest = YAML.load_file("wordpress.yml")
|
27
|
+
properties = manifest["properties"]
|
28
|
+
properties.wont_be_nil "manifest properties must be set"
|
29
|
+
properties["mysql"].wont_be_nil
|
30
|
+
properties["mysql"]["password"].must_equal 'mysqlpassword'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -2,12 +2,14 @@ require "bosh/gen/cli"
|
|
2
2
|
|
3
3
|
module GeneratorSpecHelper
|
4
4
|
def setup_universe
|
5
|
+
@@local_developer_bosh_config ||= File.expand_path("~/.bosh_config") # ENV['HOME'] messed with later
|
5
6
|
@tmp_root = File.expand_path("../../tmp", __FILE__)
|
6
7
|
@home_path = File.join(@tmp_root, "home")
|
7
8
|
@fixtures_path = File.expand_path('../../fixtures', __FILE__)
|
8
9
|
FileUtils.rm_rf @tmp_root
|
9
10
|
FileUtils.mkdir_p @home_path
|
10
11
|
ENV['HOME'] = @home_path
|
12
|
+
FileUtils.cp_r(@@local_developer_bosh_config, @home_path)
|
11
13
|
end
|
12
14
|
|
13
15
|
def setup_project_release(name)
|
@@ -29,6 +31,16 @@ module GeneratorSpecHelper
|
|
29
31
|
File.open(@stdout, "w") {|f| f << stdout; f << stderr}
|
30
32
|
end
|
31
33
|
|
34
|
+
# Runs 'bosh-gen manifest path/to/release'
|
35
|
+
# generate_manifest "path/to/release"
|
36
|
+
def generate_manifest(*args)
|
37
|
+
stdout, stderr = capture_stdios do
|
38
|
+
Bosh::Gen::Command.start(["manifest", *args])
|
39
|
+
end
|
40
|
+
@stdout = File.expand_path(File.join(@tmp_root, "generate_manifest.out"))
|
41
|
+
File.open(@stdout, "w") {|f| f << stdout; f << stderr}
|
42
|
+
end
|
43
|
+
|
32
44
|
# Test that a file exists in job
|
33
45
|
# job_file_exists "mywebapp", "monit"
|
34
46
|
# job_file_exists "mywebapp", "templates", "mywebapp_ctl", :executable => true
|
@@ -29,7 +29,7 @@ class WebappGeneratorSpec < MiniTest::Spec
|
|
29
29
|
job_template_exists "mywebapp", "helpers/ctl_setup.sh", "helpers/ctl_setup.sh"
|
30
30
|
job_template_exists "mywebapp", "helpers/ctl_utils.sh", "helpers/ctl_utils.sh"
|
31
31
|
|
32
|
-
example = File.join("examples", "
|
32
|
+
example = File.join("examples", "mywebapp.yml")
|
33
33
|
File.exist?(example).must_equal(true, "#{example} not created")
|
34
34
|
end
|
35
35
|
end
|
@@ -5,7 +5,7 @@ class DeploymentManifestSpec < MiniTest::Spec
|
|
5
5
|
it "creates manifest document with 2 jobs, no disk" do
|
6
6
|
manifest = Bosh::Gen::Models::DeploymentManifest.new("myproj", "UUID",
|
7
7
|
{"name" => "myrelease", "version" => 2},
|
8
|
-
{"instance_type" => "m1.small", "static_ips" => ['1.2.3.4', '6.7.8.9']})
|
8
|
+
{"instance_type" => "m1.small", "static_ips" => ['1.2.3.4', '6.7.8.9']}, {})
|
9
9
|
manifest.jobs = [
|
10
10
|
{ "name" => "job-with-ips"},
|
11
11
|
{ "name" => "misc"}
|
@@ -16,7 +16,7 @@ class DeploymentManifestSpec < MiniTest::Spec
|
|
16
16
|
it "creates manifest document with 2 jobs, with disk" do
|
17
17
|
manifest = Bosh::Gen::Models::DeploymentManifest.new("myproj", "UUID",
|
18
18
|
{"name" => "myrelease", "version" => 2},
|
19
|
-
{"instance_type" => "m1.small", "persistent_disk" => "8196", "static_ips" => ['1.2.3.4']})
|
19
|
+
{"instance_type" => "m1.small", "persistent_disk" => "8196", "static_ips" => ['1.2.3.4']}, {})
|
20
20
|
manifest.jobs = [
|
21
21
|
{ "name" => "job-with-ips"},
|
22
22
|
{ "name" => "misc"}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -32,17 +32,33 @@ dependencies:
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 1.0.rc1
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.0.rc1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bosh_common
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.5.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.1
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: rake
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,9 +147,9 @@ files:
|
|
131
147
|
- lib/bosh/gen/generators/extract_package_generator.rb
|
132
148
|
- lib/bosh/gen/generators/job_generator.rb
|
133
149
|
- lib/bosh/gen/generators/job_generator/templates/.gitkeep
|
150
|
+
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%.yml.tt
|
134
151
|
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_puma_migrate.yml
|
135
152
|
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_nginx_rack/nginx_rackup.yml.tt
|
136
|
-
- lib/bosh/gen/generators/job_generator/templates/examples/%job_name%_simple/default.yml
|
137
153
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/monit.tt
|
138
154
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/%job_name%_rack_ctl.tt
|
139
155
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_nginx_rack/templates/bin/ctl_db_utils.sh.erb
|
@@ -153,6 +169,7 @@ files:
|
|
153
169
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/monit.tt
|
154
170
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/%job_name%_ctl.tt
|
155
171
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/bin/monit_debugger
|
172
|
+
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/config/.gitkeep
|
156
173
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/data/properties.sh.erb
|
157
174
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_setup.sh
|
158
175
|
- lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh
|
@@ -216,6 +233,7 @@ files:
|
|
216
233
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-1.yml
|
217
234
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-10.yml
|
218
235
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-2.yml
|
236
|
+
- spec/generators/deployment_manifest_generator_spec.rb
|
219
237
|
- spec/generators/generator_spec_helper.rb
|
220
238
|
- spec/generators/jobs/webapp_job_generator_spec.rb
|
221
239
|
- spec/models/bosh_config_spec.rb
|
@@ -237,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
255
|
version: '0'
|
238
256
|
segments:
|
239
257
|
- 0
|
240
|
-
hash: -
|
258
|
+
hash: -4535094254544220290
|
241
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
260
|
none: false
|
243
261
|
requirements:
|
@@ -246,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
264
|
version: '0'
|
247
265
|
segments:
|
248
266
|
- 0
|
249
|
-
hash: -
|
267
|
+
hash: -4535094254544220290
|
250
268
|
requirements: []
|
251
269
|
rubyforge_project:
|
252
270
|
rubygems_version: 1.8.24
|
@@ -296,6 +314,7 @@ test_files:
|
|
296
314
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-1.yml
|
297
315
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-10.yml
|
298
316
|
- spec/fixtures/releases/some_dev_releases/dev_releases/myrelease-2.yml
|
317
|
+
- spec/generators/deployment_manifest_generator_spec.rb
|
299
318
|
- spec/generators/generator_spec_helper.rb
|
300
319
|
- spec/generators/jobs/webapp_job_generator_spec.rb
|
301
320
|
- spec/models/bosh_config_spec.rb
|