clc-promote 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/promote/rake_tasks.rb +5 -5
- data/lib/promote/uploader.rb +10 -14
- data/lib/promote/versioner.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0cd6b4f5ccdee96517ba9b01436fabe5c5fe77a
|
4
|
+
data.tar.gz: c5a8e1d7fe576d91d907d06564e9624df5e8d0d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6489be22cbf85bb0d4716c18663e5df0f43d77dbe21022499e760e10da5ac2f7563bc812161f326954e7d6585e7189245fc754ba3f2dc67d56bd337ce214fba
|
7
|
+
data.tar.gz: 510034cdb259d038aae9afa214665318bbf9264aeb1191d242722bacd0ab35177556699ded8e7c86ec8d0635fd87d6bdf0bc0c717a784ebfccbb59dcbd9d666e
|
data/lib/promote/rake_tasks.rb
CHANGED
@@ -126,8 +126,8 @@ module Promote
|
|
126
126
|
namespace "Promote" do
|
127
127
|
desc "Upload an environment to the chef server"
|
128
128
|
task "upload_environment", :environment do |task, args|
|
129
|
-
|
130
|
-
@uploader.
|
129
|
+
file_uploaded = @uploader.upload_environment(args.environment)
|
130
|
+
puts "Uploading #{file_uploaded} to #{@uploader.config.chef_server_url} as #{@uploader.config.node_name} using #{@uploader.config.client_key}"
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
@@ -135,9 +135,9 @@ module Promote
|
|
135
135
|
def define_upload_data_bags
|
136
136
|
namespace "Promote" do
|
137
137
|
desc "Upload data_bags to the chef server"
|
138
|
-
task "upload_data_bags" do
|
139
|
-
|
140
|
-
@uploader.
|
138
|
+
task "upload_data_bags" do
|
139
|
+
file_uploaded = @uploader.upload_data_bags
|
140
|
+
puts "Uploading #{file_uploaded} to #{@uploader.config.chef_server_url} as #{@uploader.config.node_name} using #{@uploader.config.client_key}"
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
data/lib/promote/uploader.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'chef'
|
2
|
-
require 'chef/chef_fs/knife'
|
3
2
|
require 'chef/chef_fs/parallelizer'
|
4
3
|
require 'chef/chef_fs/config'
|
5
4
|
require 'chef/chef_fs/file_pattern'
|
@@ -7,7 +6,6 @@ require 'chef/chef_fs/file_system'
|
|
7
6
|
require 'chef/config'
|
8
7
|
require 'chef/knife/cookbook_upload'
|
9
8
|
require 'chef/chef_fs/path_utils'
|
10
|
-
require 'chef/knife/upload'
|
11
9
|
|
12
10
|
module Promote
|
13
11
|
class Uploader
|
@@ -18,6 +16,7 @@ module Promote
|
|
18
16
|
Chef::Config[:client_key] = config.client_key
|
19
17
|
Chef::Config[:chef_server_url] = config.chef_server_url
|
20
18
|
Chef::Config[:node_name] = config.node_name
|
19
|
+
Chef::Config[:chef_repo_path] = config.repo_root
|
21
20
|
end
|
22
21
|
|
23
22
|
def upload_cookbooks
|
@@ -54,27 +53,24 @@ module Promote
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def upload_environment(environment_name)
|
57
|
-
|
58
|
-
knife.config[:chef_repo_path] = config.repo_root
|
59
|
-
Chef::ChefFS::Knife.deps do
|
60
|
-
knife.configure_chef
|
61
|
-
knife.run
|
62
|
-
end
|
56
|
+
upload_file("/environments/#{environment_name}.json")
|
63
57
|
end
|
64
58
|
|
65
59
|
def upload_data_bags
|
66
|
-
|
67
|
-
knife.config[:chef_repo_path] = config.repo_root
|
68
|
-
Chef::ChefFS::Knife.deps do
|
69
|
-
knife.configure_chef
|
70
|
-
knife.run
|
71
|
-
end
|
60
|
+
upload_file("/data_bags")
|
72
61
|
end
|
73
62
|
|
74
63
|
attr_accessor :config
|
75
64
|
|
76
65
|
private
|
77
66
|
|
67
|
+
def upload_file(file_path)
|
68
|
+
fs_config = Chef::ChefFS::Config.new
|
69
|
+
pattern = Chef::ChefFS::FilePattern.new(Chef::ChefFS::PathUtils::join(fs_config.base_path, file_path))
|
70
|
+
Chef::ChefFS::FileSystem.copy_to(pattern, fs_config.local_fs, fs_config.chef_fs, 1, Chef::Config)
|
71
|
+
file_path
|
72
|
+
end
|
73
|
+
|
78
74
|
def validate_config
|
79
75
|
required_keys = [:client_key, :chef_server_url, :node_name]
|
80
76
|
missing_keys = []
|
data/lib/promote/versioner.rb
CHANGED