dev-lxc 0.6.2 → 0.6.3
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 +4 -4
- data/lib/dev-lxc/cli.rb +2 -1
- data/lib/dev-lxc/cluster.rb +31 -18
- data/lib/dev-lxc/server.rb +27 -20
- data/lib/dev-lxc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c4caf061044c84378f0ddc6f2b230bf471316bd
|
|
4
|
+
data.tar.gz: 38604c98358572ef9c01cdf0b5bb3c123d12909e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f21d2ec078c477fb6d1d3c2bed8329ecc2d09dba2f2f9e5f2683ca73fc7ae40b6992d687588b0478b5fc149e6e30c4fbd8323dcfa5ece1fb36d8224aea5881f
|
|
7
|
+
data.tar.gz: a4045af580cc0c357c6799ef29e4eb0b8785ec40a431897e63976b4cdd6394e26ebadebaaf08b763937118b54f9af3bb11a2d927193d6eb67d92f2585c7e8743
|
data/lib/dev-lxc/cli.rb
CHANGED
|
@@ -77,8 +77,9 @@ module DevLXC::CLI
|
|
|
77
77
|
|
|
78
78
|
desc "chef-repo", "Creates a `bootstrap-node` script and chef-repo in the current directory using files from the cluster's backend /root/chef-repo"
|
|
79
79
|
option :config, :desc => "Specify a cluster's YAML config file. `./dev-lxc.yml` will be used by default"
|
|
80
|
+
option :pivotal, :aliases => "-p", :type => :boolean, :desc => "Also copy pivotal.rb and pivotal.pem"
|
|
80
81
|
def chef_repo
|
|
81
|
-
get_cluster(options[:config]).chef_repo
|
|
82
|
+
get_cluster(options[:config]).chef_repo(options[:pivotal])
|
|
82
83
|
end
|
|
83
84
|
|
|
84
85
|
desc "list_images [SERVER_NAME_REGEX]", "List of each servers' images created during the build process"
|
data/lib/dev-lxc/cluster.rb
CHANGED
|
@@ -58,7 +58,7 @@ module DevLXC
|
|
|
58
58
|
servers = chef_servers + analytics_servers
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def chef_repo
|
|
61
|
+
def chef_repo(copy_pivotal=false)
|
|
62
62
|
if @chef_server_bootstrap_backend.nil?
|
|
63
63
|
puts "A bootstrap backend Chef Server is not defined in the cluster's config. Please define it first."
|
|
64
64
|
exit 1
|
|
@@ -76,34 +76,47 @@ module DevLXC
|
|
|
76
76
|
if pem_files.empty?
|
|
77
77
|
puts "The pem files can not be copied because they do not exist in '#{chef_server.server.name}' Chef Server's `/root/chef-repo/.chef` directory"
|
|
78
78
|
else
|
|
79
|
+
pem_files.delete_if { |pem_file| pem_file.end_with?("/pivotal.pem") } unless copy_pivotal
|
|
79
80
|
FileUtils.cp( pem_files, "./chef-repo/.chef" )
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
if @chef_server_topology == "open-source"
|
|
83
84
|
chef_server_url = "https://#{@api_fqdn}"
|
|
84
|
-
username = "admin"
|
|
85
85
|
validator_name = "chef-validator"
|
|
86
86
|
else
|
|
87
|
+
chef_server_root = "https://#{@api_fqdn}"
|
|
87
88
|
chef_server_url = "https://#{@api_fqdn}/organizations/ponyville"
|
|
88
|
-
username = "rainbowdash"
|
|
89
89
|
validator_name = "ponyville-validator"
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
knife_rb = %Q(
|
|
93
|
-
current_dir = File.dirname(__FILE__)
|
|
94
|
-
|
|
95
|
-
chef_server_url "#{chef_server_url}"
|
|
96
90
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
if copy_pivotal
|
|
92
|
+
if File.exists?("./chef-repo/.chef/pivotal.rb")
|
|
93
|
+
puts "Skipping pivotal.rb because it already exists in `./chef-repo/.chef`"
|
|
94
|
+
else
|
|
95
|
+
pivotal_rb_path = "#{chef_server.abspath('/root/chef-repo/.chef')}/pivotal.rb"
|
|
96
|
+
if File.exists?(pivotal_rb_path)
|
|
97
|
+
pivotal_rb = IO.read(pivotal_rb_path)
|
|
98
|
+
pivotal_rb.sub!(/^chef_server_root .*/, "chef_server_root \"#{chef_server_root}\"")
|
|
99
|
+
pivotal_rb.sub!(/^chef_server_url .*/, "chef_server_url \"#{chef_server_url}\"")
|
|
100
|
+
IO.write("./chef-repo/.chef/pivotal.rb", pivotal_rb)
|
|
101
|
+
else
|
|
102
|
+
puts "The pivotal.rb file can not be copied because it does not exist in '#{chef_server.server.name}' Chef Server's `/root/chef-repo/.chef` directory"
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
102
107
|
|
|
103
|
-
|
|
104
|
-
knife
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
if File.exists?("./chef-repo/.chef/knife.rb")
|
|
109
|
+
puts "Skipping knife.rb because it already exists in `./chef-repo/.chef`"
|
|
110
|
+
else
|
|
111
|
+
knife_rb_path = "#{chef_server.abspath('/root/chef-repo/.chef')}/knife.rb"
|
|
112
|
+
if File.exists?(knife_rb_path)
|
|
113
|
+
knife_rb = IO.read(knife_rb_path)
|
|
114
|
+
knife_rb.sub!(/^chef_server_url .*/, "chef_server_url \"#{chef_server_url}\"")
|
|
115
|
+
IO.write("./chef-repo/.chef/knife.rb", knife_rb)
|
|
116
|
+
else
|
|
117
|
+
puts "The knife.rb file can not be copied because it does not exist in '#{chef_server.server.name}' Chef Server's `/root/chef-repo/.chef` directory"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
107
120
|
|
|
108
121
|
bootstrap_node = %Q(#!/bin/bash
|
|
109
122
|
|
data/lib/dev-lxc/server.rb
CHANGED
|
@@ -362,38 +362,29 @@ module DevLXC
|
|
|
362
362
|
validator_name = "chef-validator"
|
|
363
363
|
|
|
364
364
|
FileUtils.cp( Dir.glob("#{@server.config_item('lxc.rootfs')}/etc/chef-server/{admin,chef-validator}.pem"), "#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef" )
|
|
365
|
-
when 'private-chef'
|
|
365
|
+
when 'private-chef', 'chef-server-core'
|
|
366
|
+
chef_server_root = "https://127.0.0.1"
|
|
366
367
|
chef_server_url = "https://127.0.0.1/organizations/ponyville"
|
|
367
368
|
username = "rainbowdash"
|
|
368
369
|
validator_name = "ponyville-validator"
|
|
369
370
|
|
|
370
|
-
#
|
|
371
|
-
|
|
371
|
+
FileUtils.cp( "#{@server.config_item('lxc.rootfs')}/etc/opscode/pivotal.pem", "#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef" )
|
|
372
|
+
|
|
372
373
|
pivotal_rb = %Q(
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
current_dir = File.dirname(__FILE__)
|
|
375
|
+
|
|
376
|
+
chef_server_root "#{chef_server_root}"
|
|
377
|
+
chef_server_url "#{chef_server_url}"
|
|
375
378
|
|
|
376
379
|
node_name "pivotal"
|
|
377
|
-
client_key "/
|
|
380
|
+
client_key "\#{current_dir}/pivotal.pem"
|
|
378
381
|
|
|
382
|
+
cookbook_path Dir.pwd + "/cookbooks"
|
|
379
383
|
knife[:chef_repo_path] = Dir.pwd
|
|
380
384
|
)
|
|
381
385
|
IO.write("#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef/pivotal.rb", pivotal_rb)
|
|
382
|
-
@server.run_command("/opt/opscode/embedded/bin/gem install knife-opc --no-ri --no-rdoc")
|
|
383
|
-
@server.run_command("/opt/opscode/embedded/bin/knife opc org create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem -c /root/chef-repo/.chef/pivotal.rb")
|
|
384
|
-
@server.run_command("/opt/opscode/embedded/bin/knife opc user create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem -c /root/chef-repo/.chef/pivotal.rb")
|
|
385
|
-
@server.run_command("/opt/opscode/embedded/bin/knife opc org user add ponyville rainbowdash --admin -c /root/chef-repo/.chef/pivotal.rb")
|
|
386
|
-
when 'chef-server-core'
|
|
387
|
-
chef_server_url = "https://127.0.0.1/organizations/ponyville"
|
|
388
|
-
username = "rainbowdash"
|
|
389
|
-
validator_name = "ponyville-validator"
|
|
390
|
-
|
|
391
|
-
# give time for all services to come up completely
|
|
392
|
-
sleep 10
|
|
393
|
-
run_ctl(@server_ctl, "org-create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem")
|
|
394
|
-
run_ctl(@server_ctl, "user-create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem")
|
|
395
|
-
run_ctl(@server_ctl, "org-user-add ponyville rainbowdash --admin")
|
|
396
386
|
end
|
|
387
|
+
|
|
397
388
|
knife_rb = %Q(
|
|
398
389
|
current_dir = File.dirname(__FILE__)
|
|
399
390
|
|
|
@@ -409,6 +400,22 @@ cookbook_path Dir.pwd + "/cookbooks"
|
|
|
409
400
|
knife[:chef_repo_path] = Dir.pwd
|
|
410
401
|
)
|
|
411
402
|
IO.write("#{@server.config_item('lxc.rootfs')}/root/chef-repo/.chef/knife.rb", knife_rb)
|
|
403
|
+
|
|
404
|
+
case @chef_server_type
|
|
405
|
+
when 'private-chef'
|
|
406
|
+
# give time for all services to come up completely
|
|
407
|
+
sleep 60
|
|
408
|
+
@server.run_command("/opt/opscode/embedded/bin/gem install knife-opc --no-ri --no-rdoc")
|
|
409
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc org create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem -c /root/chef-repo/.chef/pivotal.rb")
|
|
410
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc user create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem -c /root/chef-repo/.chef/pivotal.rb")
|
|
411
|
+
@server.run_command("/opt/opscode/embedded/bin/knife opc org user add ponyville rainbowdash --admin -c /root/chef-repo/.chef/pivotal.rb")
|
|
412
|
+
when 'chef-server-core'
|
|
413
|
+
# give time for all services to come up completely
|
|
414
|
+
sleep 10
|
|
415
|
+
run_ctl(@server_ctl, "org-create ponyville ponyville --filename /root/chef-repo/.chef/ponyville-validator.pem")
|
|
416
|
+
run_ctl(@server_ctl, "user-create rainbowdash rainbowdash rainbowdash rainbowdash@noreply.com rainbowdash --filename /root/chef-repo/.chef/rainbowdash.pem")
|
|
417
|
+
run_ctl(@server_ctl, "org-user-add ponyville rainbowdash --admin")
|
|
418
|
+
end
|
|
412
419
|
end
|
|
413
420
|
end
|
|
414
421
|
end
|
data/lib/dev-lxc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dev-lxc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremiah Snapp
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-03-
|
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|