ops_team 1.20.0 → 1.20.2.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74e3e7c3b99af394b1eb19ee35cc137cfde7a883a4236a56d2fb0010564b3d2d
4
- data.tar.gz: 7765ee48f6a6e38e9443a8926354f7a126b817ad09b937ff0adad839e458a0d6
3
+ metadata.gz: 455f0e62f07bc41ac0ef70c79c622a3ae367bf1f73f3b903b63a8a7a7d29cef8
4
+ data.tar.gz: bc91912b9c30b81ce6f5afb615bb33d0f13f092dcdc20c3fa77ff2536167c421
5
5
  SHA512:
6
- metadata.gz: b2aa262433e8a724f8255c42c3a5929baae08752029aeb3c80302105b4bb472113cafe2216db1ea86af54d238102eed0c27459b38d34aab34970b79dced5ce68
7
- data.tar.gz: f1d3572c52f15e3ac504871617b60e992ad25a57545e50444f9409faa2a3371b883c731e6c4ec462b928cdfd50a8c46c4123110e44f25435f290a3c5bebf1142
6
+ metadata.gz: 1b7ff635a4f099ef8ec0bea62b5ae18027520d6d45f9ce94807979741d5c73588dcd635165330fc771921a26a6068f57f8cf56802f457a78938cd780b37d3cc6
7
+ data.tar.gz: 6eabc65621b9e6e8fc2102a9eff392e1b1347e07e886c6142603de55aa7e610ff1099525cb19895db8901555a6e4fc56d05b69a6f3dc146e79c0ffff5c5cf963
data/bin/ops.orig ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
5
+
6
+ require_relative '../lib/profiler'
7
+ require 'optparse'
8
+
9
+ def usage
10
+ puts "Usage: ops [-f|--file <ops_yml>] action [<action args>"
11
+ puts " ops_yml: the config file to load instead of './ops.yml'"
12
+ puts " action_args: arguments to the action loaded from the config file; depends on the action"
13
+
14
+ exit(1)
15
+ end
16
+
17
+ options = {}
18
+ status = -1
19
+
20
+ while ARGV[0]&.match(/^-/)
21
+ opt = ARGV.shift
22
+ case opt
23
+ when '-f', '--file'
24
+ usage unless ARGV.length >= 1
25
+
26
+ options[:file] = ARGV.shift
27
+ else
28
+ usage
29
+ end
30
+ end
31
+
32
+ Profiler.measure("bin:require") do
33
+ require_relative "../loader"
34
+ end
35
+
36
+ Profiler.measure("bin:run") do
37
+ status = Ops.new(ARGV, config_file: options[:file]).run
38
+ end
39
+
40
+ Profiler.add_measurement("bin:all", Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time)
41
+ Output.error(Profiler.summary) if Profiler.summary
42
+ exit status
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tempfile"
4
+
5
+ module Dependencies
6
+ module Helpers
7
+ class SshKeyDecryptor
8
+ def initialize(source_key_path, passphrase)
9
+ @source_key_path = source_key_path
10
+ @passphrase = passphrase
11
+ end
12
+
13
+ def plaintext_key
14
+ @plaintext_key ||= begin
15
+ plaintext = decrypt_key
16
+
17
+ File.delete(temp_key_file.path)
18
+
19
+ plaintext
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def temp_key_file
26
+ @temp_key_file ||= Tempfile.new("ops")
27
+ end
28
+
29
+ def decrypt_key
30
+ FileUtils.cp(@source_key_path, temp_key_file.path)
31
+ `ssh-keygen -f '#{temp_key_file.path}' -p -P '#{@passphrase}' </dev/null`
32
+
33
+ File.read(temp_key_file.path)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -54,7 +54,11 @@ module Dependencies
54
54
  end
55
55
 
56
56
  def unencrypted_key
57
- Net::SSH::KeyFactory.load_private_key(priv_key_name, passphrase.empty? ? nil : passphrase)
57
+ Net::SSH::KeyFactory.load_data_private_key(decryptor.plaintext_key, nil)
58
+ end
59
+
60
+ def decryptor
61
+ @decryptor ||= Helpers::SshKeyDecryptor.new(priv_key_name, passphrase)
58
62
  end
59
63
 
60
64
  def key_comment
data/ops_team.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '1.20.0'
5
+ s.version = '1.20.2-rc1'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_team
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.20.2.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com
@@ -180,6 +180,7 @@ files:
180
180
  - Gemfile
181
181
  - bin/benchmark
182
182
  - bin/ops
183
+ - bin/ops.orig
183
184
  - bin/print_config
184
185
  - bin/print_secrets
185
186
  - bin/tag
@@ -214,6 +215,7 @@ files:
214
215
  - lib/dependencies/docker.rb
215
216
  - lib/dependencies/gem.rb
216
217
  - lib/dependencies/helpers/apt_cache_policy.rb
218
+ - lib/dependencies/helpers/ssh_key_decryptor.rb
217
219
  - lib/dependencies/pip.rb
218
220
  - lib/dependencies/snap.rb
219
221
  - lib/dependencies/sshkey.rb
@@ -248,9 +250,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
250
  version: '2.5'
249
251
  required_rubygems_version: !ruby/object:Gem::Requirement
250
252
  requirements:
251
- - - ">="
253
+ - - ">"
252
254
  - !ruby/object:Gem::Version
253
- version: '0'
255
+ version: 1.3.1
254
256
  requirements: []
255
257
  rubygems_version: 3.3.7
256
258
  signing_key: