deploy_rubygem 0.60.21 → 0.60.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +3 -3
- data/lib/deploy_rubygem/chef_node.rb +60 -0
- data/lib/deploy_rubygem/inspectestor.rb +7 -2
- data/lib/deploy_rubygem/project.rb +1 -0
- data/lib/deploy_rubygem/version.rb +1 -3
- data/lib/deploy_rubygem/workstation.rb +47 -26
- data.tar.gz.sig +0 -0
- metadata +4 -13
- metadata.gz.sig +0 -0
- data/bin/deploy_jimbodragon +0 -8
- data/bin/deploy_rubygem +0 -8
- data/bin/deploy_rubygem_manually +0 -4
- data/bin/prepare_workstation +0 -3
- data/bin/test_deploy_rubygem +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0025eb35e02d5cfc5cfcdba4ef9d1a2c3e1460f478cb48869e488ff9eb772460
|
4
|
+
data.tar.gz: 32ebfdd0c7f113c93dc8720fa172d2455428ca3438dec6f83c51f0edc2a4f0ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60383e359731709cdf24b7e97935d777a7f69e6191759206a5e03ebee8462abb934d2b562e795df4a2c8141a8063e2e0b2ce9055ad2520ff4d66286ba0e673ee
|
7
|
+
data.tar.gz: 930c0a40af5f0235c637ec9800deea3f242e035796c573eb32cc0af879513f6efa36af2049e000c7bdb60eba1d620571a158033e2928669dd4712df20fac44c2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -12,12 +12,12 @@ RuboCop::RakeTask.new
|
|
12
12
|
|
13
13
|
task test_framework: %i[clean rubocop spec]
|
14
14
|
task default: %i[test_framework build install:local]
|
15
|
-
task cicd: %i[default
|
15
|
+
task cicd: %i[default test_version]
|
16
16
|
task test_version: %i[install compliance]
|
17
17
|
task :compliance do
|
18
|
-
|
18
|
+
system('inspec exec compliance')
|
19
19
|
end
|
20
|
-
task developper: %i[push
|
20
|
+
task developper: %i[rubocop push default release]
|
21
21
|
task :push do
|
22
22
|
system('git add .')
|
23
23
|
system("git commit -m 'Rake pusing version #{DeployRubygem::VERSION}'")
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
# DeployRubygem - deploy a gem using rake
|
6
|
+
# Containing a class
|
7
|
+
module DeployRubygem
|
8
|
+
# Using Project to deploy and manage Project
|
9
|
+
class ChefNode
|
10
|
+
attr_reader :chef_server_url, :nodename, :policyname, :policygroup, :knife_name, :chef_client_key
|
11
|
+
|
12
|
+
def initialize(options)
|
13
|
+
@chef_server_url = options['chef_server_url']
|
14
|
+
@nodename = options['node_name']
|
15
|
+
@policyname = options['policyname']
|
16
|
+
@policygrouop = options['policygrouop']
|
17
|
+
@knife_name = options['knife_name']
|
18
|
+
@chef_client_key = options['chef_client_key']
|
19
|
+
end
|
20
|
+
|
21
|
+
def clientrb
|
22
|
+
{
|
23
|
+
log_location: '/var/log/chef-client.log',
|
24
|
+
chef_server_url: chef_server_url,
|
25
|
+
chef_license: 'accept',
|
26
|
+
file_cache_path: '/var/chef/cache',
|
27
|
+
file_backup_path: '/var/chef/backup',
|
28
|
+
node_name: nodename,
|
29
|
+
policy_name: policyname,
|
30
|
+
policy_group: policygroup
|
31
|
+
}.map do |key, value|
|
32
|
+
key_pair = [key, "'#{value}'"]
|
33
|
+
key_pair.join(' ')
|
34
|
+
end.join("\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
def read_file(file_path)
|
38
|
+
puts "REading file #{file_path}"
|
39
|
+
puts File.read(file_path)
|
40
|
+
puts "Had read #{File.read(file_path).split('\n').length} lines"
|
41
|
+
end
|
42
|
+
|
43
|
+
def boostrap
|
44
|
+
clientrb_file = '/etc/chef/client.rb'
|
45
|
+
clientpem_file = '/etc/chef/client.pem'
|
46
|
+
|
47
|
+
Dir.mkdir('/etc/chef') unless Dir.exist?('/etc/chef')
|
48
|
+
|
49
|
+
File.write(clientrb_file, clientrb)
|
50
|
+
File.write(clientpem_file, chef_client_key.split('\\n').join("\n"))
|
51
|
+
|
52
|
+
[clientrb_file, clientpem_file].each do |file_path|
|
53
|
+
FileUtils.chmod(0o600, file_path)
|
54
|
+
# read_file(file_path)
|
55
|
+
end
|
56
|
+
|
57
|
+
system('chef env --chef-license accept')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -34,7 +34,7 @@ module DeployRubygem
|
|
34
34
|
def update
|
35
35
|
system("rm -rf #{inspec_path}/vendor")
|
36
36
|
system("rm #{inspec_path}/inspec.lock")
|
37
|
-
system("inspec vendor #{inspec_path}")
|
37
|
+
system("inspec vendor #{inspec_path} ")
|
38
38
|
end
|
39
39
|
|
40
40
|
def save_as_html(html_file)
|
@@ -48,8 +48,12 @@ module DeployRubygem
|
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
|
+
def chef_license
|
52
|
+
'--chef-licens accept'
|
53
|
+
end
|
54
|
+
|
51
55
|
def inspec_options
|
52
|
-
cmd_opt = []
|
56
|
+
cmd_opt = [chef_license]
|
53
57
|
|
54
58
|
unless input_file.nil?
|
55
59
|
cmd_opt << '--input-file'
|
@@ -60,6 +64,7 @@ module DeployRubygem
|
|
60
64
|
cmd_opt << '--waiver-file'
|
61
65
|
cmd_opt << waiver_file
|
62
66
|
end
|
67
|
+
puts "Using inspec options #{cmd_opt}"
|
63
68
|
cmd_opt
|
64
69
|
end
|
65
70
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'git-version-bump'
|
4
|
-
|
5
3
|
require_relative 'rubygem'
|
6
4
|
require_relative 'deploy_rubygem_options'
|
7
5
|
|
@@ -17,5 +15,5 @@ module DeployRubygem
|
|
17
15
|
end
|
18
16
|
|
19
17
|
# VERSION = new_deploy_rubygem.gvb_version.short_version
|
20
|
-
VERSION = '0.60.
|
18
|
+
VERSION = '0.60.22'
|
21
19
|
end
|
@@ -1,54 +1,75 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'fileutils'
|
4
|
+
require_relative 'chef_node'
|
4
5
|
|
5
6
|
# DeployRubygem - deploy a gem using rake
|
6
7
|
# Containing a class
|
7
8
|
module DeployRubygem
|
8
9
|
# Using Project to deploy and manage Project
|
9
10
|
class Workstation
|
11
|
+
attr_reader :chef_server_url, :nodename, :policyname, :policygroup, :knife_name, :chef_client_key, :chef_knife_key, :user_folder
|
12
|
+
|
13
|
+
def initialize(options)
|
14
|
+
@chef_server_url = options['chef_server_url']
|
15
|
+
@nodename = options['node_name']
|
16
|
+
@policyname = options['policyname']
|
17
|
+
@policygroup = options['policygroup']
|
18
|
+
@knife_name = options['knife_name']
|
19
|
+
@chef_knife_key = options['chef_knife_key']
|
20
|
+
@user_folder = options['user_folder']
|
21
|
+
end
|
22
|
+
|
10
23
|
def clientrb
|
11
24
|
{
|
12
|
-
log_location: '
|
13
|
-
chef_server_url:
|
25
|
+
log_location: File.join(ENV['HOME'], '.chef', 'chef-client.log'),
|
26
|
+
chef_server_url: chef_server_url,
|
14
27
|
chef_license: 'accept',
|
15
|
-
file_cache_path: '
|
16
|
-
file_backup_path: '
|
17
|
-
node_name:
|
18
|
-
policy_name:
|
19
|
-
policy_group:
|
28
|
+
file_cache_path: File.join(ENV['HOME'], '.chef', 'cache'),
|
29
|
+
file_backup_path: File.join(ENV['HOME'], '.chef', 'backup'),
|
30
|
+
node_name: nodename,
|
31
|
+
policy_name: policyname,
|
32
|
+
policy_group: policygroup
|
20
33
|
}.map do |key, value|
|
21
|
-
[key, "'#{value}'"]
|
34
|
+
key_pair = [key, "'#{value}'"]
|
35
|
+
key_pair.join(' ')
|
22
36
|
end.join("\n")
|
23
37
|
end
|
24
38
|
|
25
39
|
def credential
|
26
40
|
(['[default]'] + {
|
27
|
-
client_name:
|
28
|
-
client_key: File.join(
|
29
|
-
chef_server_url:
|
30
|
-
# secret_file: File.join(
|
41
|
+
client_name: knife_name,
|
42
|
+
client_key: File.join(user_folder, '.chef', 'cicd.pem'),
|
43
|
+
chef_server_url: chef_server_url
|
44
|
+
# secret_file: File.join(user_folder, '.chef', 'cicd.secret')
|
31
45
|
}.map do |key, value|
|
32
|
-
[key, "'#{value}'"].join(' ')
|
46
|
+
[key, '=', "'#{value}'"].join(' ')
|
33
47
|
end).join("\n")
|
34
48
|
end
|
35
49
|
|
50
|
+
def read_file(file_path)
|
51
|
+
puts "REading file #{file_path}"
|
52
|
+
puts File.read(file_path)
|
53
|
+
puts "Had read #{File.read(file_path).split('\n').length} lines"
|
54
|
+
end
|
55
|
+
|
36
56
|
def boostrap_workstation
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
File.
|
42
|
-
|
43
|
-
File.write(
|
57
|
+
knife_file = File.join(user_folder, '.chef', 'knife.rb')
|
58
|
+
cicdpem_file = File.join(user_folder, '.chef', 'cicd.pem')
|
59
|
+
cicdcredential_file = File.join(user_folder, '.chef', 'credentials')
|
60
|
+
|
61
|
+
Dir.mkdir(File.join(user_folder, '.chef'))
|
62
|
+
|
63
|
+
File.write(knife_file, clientrb)
|
64
|
+
File.write(cicdpem_file, chef_knife_key.split('\\n').join("\n"))
|
44
65
|
File.write(cicdcredential_file, credential)
|
45
66
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
67
|
+
[knife_file, cicdpem_file, cicdcredential_file].each do |file_path|
|
68
|
+
FileUtils.chmod(0o600, file_path)
|
69
|
+
# read_file(file_path)
|
70
|
+
end
|
50
71
|
|
51
|
-
system('chef-
|
72
|
+
system('chef env --chef-license accept')
|
52
73
|
end
|
53
74
|
end
|
54
75
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deploy_rubygem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.60.
|
4
|
+
version: 0.60.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Provencher
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
n6Pwa3EckU/5n8N6gUJTAmGyu6Ncu1pbsZtH450+BJ2z82JNXomdFYlnG8+1XNlj
|
34
34
|
3M1sBFUHvqrBg2hQkQcLHokmQYrYsRK5A7HrxwKcmwM=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2024-06-
|
36
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec
|
@@ -109,12 +109,7 @@ description: Using Chef cookbook style and force any script using it to switch t
|
|
109
109
|
chef even if it is not install. It will install it tho ;)
|
110
110
|
email:
|
111
111
|
- jimbo_dragon@hotmail.com
|
112
|
-
executables:
|
113
|
-
- deploy_rubygem
|
114
|
-
- prepare_workstation
|
115
|
-
- test_deploy_rubygem
|
116
|
-
- deploy_rubygem_manually
|
117
|
-
- deploy_jimbodragon
|
112
|
+
executables: []
|
118
113
|
extensions: []
|
119
114
|
extra_rdoc_files:
|
120
115
|
- README.md
|
@@ -129,13 +124,9 @@ files:
|
|
129
124
|
- LICENSE.txt
|
130
125
|
- README.md
|
131
126
|
- Rakefile
|
132
|
-
- bin/deploy_jimbodragon
|
133
|
-
- bin/deploy_rubygem
|
134
|
-
- bin/deploy_rubygem_manually
|
135
|
-
- bin/prepare_workstation
|
136
|
-
- bin/test_deploy_rubygem
|
137
127
|
- exe/deploy_rubygem
|
138
128
|
- lib/deploy_rubygem.rb
|
129
|
+
- lib/deploy_rubygem/chef_node.rb
|
139
130
|
- lib/deploy_rubygem/cookbook.rb
|
140
131
|
- lib/deploy_rubygem/deploy_rubygem_options.rb
|
141
132
|
- lib/deploy_rubygem/inspec_result.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/bin/deploy_jimbodragon
DELETED
data/bin/deploy_rubygem
DELETED
data/bin/deploy_rubygem_manually
DELETED
data/bin/prepare_workstation
DELETED