ops_team 1.2.4 → 1.4.0
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/Gemfile +1 -0
- data/lib/builtins/countdown.rb +74 -0
- data/lib/dependencies/sshkey.rb +12 -1
- data/ops_team.gemspec +4 -3
- metadata +32 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acb68f893870d3f80465ed28d10902c2fe24ac849d1870d160425024648840cb
|
4
|
+
data.tar.gz: bf5b86aafc47e0988133a6aec9774b416c625f19a5c210328a351362fd51d478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c99a5ca997ff084cefb8e7a8afc97b4ca89a22bf1338a6d9d00c2313cf41163dd4c4e148aad7871577e474d48195d9029c74ca0c6af754031b41b9c6adf7b0be
|
7
|
+
data.tar.gz: 50b98f0d6ace6c1c1c5ce1c1e65b36a7c5773deef12f10b60b429b243afe81ec2935109ea835fa74f027f05dbbbb9130e1c8615423c7c7aa2f24ffd5bc0df403
|
data/Gemfile
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'concurrent'
|
4
|
+
|
5
|
+
require 'builtin'
|
6
|
+
require 'output'
|
7
|
+
|
8
|
+
module Builtins
|
9
|
+
class Countdown < Builtin
|
10
|
+
USAGE_STRING = "Usage: ops countdown <seconds>"
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def description
|
14
|
+
"Like `sleep`, but displays time remaining in terminal."
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def run
|
19
|
+
check_args
|
20
|
+
|
21
|
+
timer_task.execute
|
22
|
+
|
23
|
+
while timer_task.running?
|
24
|
+
sleep(1)
|
25
|
+
timer_task.shutdown if task_complete?
|
26
|
+
end
|
27
|
+
Output.out("\rCountdown complete after #{sleep_seconds}s.")
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def check_args
|
33
|
+
check_arg_count
|
34
|
+
check_arg_is_positive_int
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_arg_count
|
38
|
+
raise Builtin::ArgumentError, USAGE_STRING unless args.length == 1
|
39
|
+
end
|
40
|
+
|
41
|
+
def check_arg_is_positive_int
|
42
|
+
raise Builtin::ArgumentError, USAGE_STRING unless sleep_seconds.positive?
|
43
|
+
# raised when the arg is not an int
|
44
|
+
rescue ::ArgumentError
|
45
|
+
raise Builtin::ArgumentError, USAGE_STRING
|
46
|
+
end
|
47
|
+
|
48
|
+
def timer_task
|
49
|
+
@timer_task ||= Concurrent::TimerTask.new(run_now: true, execution_interval: 1) do
|
50
|
+
Output.print("\r \r#{seconds_left}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def sleep_seconds
|
55
|
+
Integer(args.first)
|
56
|
+
end
|
57
|
+
|
58
|
+
def task_start_time
|
59
|
+
@task_start_time ||= Time.now
|
60
|
+
end
|
61
|
+
|
62
|
+
def task_end_time
|
63
|
+
@task_end_time ||= task_start_time + sleep_seconds
|
64
|
+
end
|
65
|
+
|
66
|
+
def task_complete?
|
67
|
+
Time.now > task_end_time
|
68
|
+
end
|
69
|
+
|
70
|
+
def seconds_left
|
71
|
+
Integer(task_end_time - Time.now + 1)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/dependencies/sshkey.rb
CHANGED
@@ -9,6 +9,7 @@ module Dependencies
|
|
9
9
|
DEFAULT_KEY_SIZE = 2048
|
10
10
|
DEFAULT_KEY_ALGO = "rsa"
|
11
11
|
DEFAULT_KEY_LIFETIME_S = 3600
|
12
|
+
DEFAULT_KEY_FILE_COMMENT_COMMAND = "$USER@`hostname -s`"
|
12
13
|
|
13
14
|
def met?
|
14
15
|
# we always need to at least update the key lifetime in the agent
|
@@ -36,7 +37,9 @@ module Dependencies
|
|
36
37
|
private
|
37
38
|
|
38
39
|
def generate_key
|
39
|
-
execute(
|
40
|
+
execute(
|
41
|
+
"ssh-keygen -b #{opt_key_size} -t #{opt_key_algo} -f #{priv_key_name} -q -N '#{passphrase}' -C '#{key_file_comment}'"
|
42
|
+
)
|
40
43
|
end
|
41
44
|
|
42
45
|
def add_key
|
@@ -59,6 +62,10 @@ module Dependencies
|
|
59
62
|
Ops.project_name
|
60
63
|
end
|
61
64
|
|
65
|
+
def key_file_comment
|
66
|
+
`echo #{opt_key_file_comment_command}`.chomp
|
67
|
+
end
|
68
|
+
|
62
69
|
def dir_name
|
63
70
|
`echo #{File.dirname(name)}`.chomp
|
64
71
|
end
|
@@ -107,5 +114,9 @@ module Dependencies
|
|
107
114
|
def opt_key_lifetime
|
108
115
|
Options.get("sshkey.key_lifetime") || DEFAULT_KEY_LIFETIME_S
|
109
116
|
end
|
117
|
+
|
118
|
+
def opt_key_file_comment_command
|
119
|
+
Options.get("sshkey.key_file_comment") || DEFAULT_KEY_FILE_COMMENT_COMMAND
|
120
|
+
end
|
110
121
|
end
|
111
122
|
end
|
data/ops_team.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ops_team'
|
5
|
-
s.version = '1.
|
5
|
+
s.version = '1.4.0'
|
6
6
|
s.authors = [
|
7
7
|
'nickthecook@gmail.com'
|
8
8
|
]
|
9
|
-
s.date = '
|
10
|
-
s.summary = 'ops_team handles basic operations tasks for your project, driven by YAML config'
|
9
|
+
s.date = '2021-05-05'
|
10
|
+
s.summary = 'ops_team handles basic operations tasks for your project, driven by self-documenting YAML config'
|
11
11
|
s.homepage = 'https://github.com/nickthecook/ops'
|
12
12
|
s.files = Dir[
|
13
13
|
'Gemfile',
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.required_ruby_version = '~> 2.5'
|
26
26
|
s.add_runtime_dependency 'bcrypt_pbkdf', '~> 1.0', '>= 1.0.1'
|
27
27
|
s.add_runtime_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
28
|
+
s.add_runtime_dependency 'concurrent-ruby', '~> 1.1', '>= 1.1.7'
|
28
29
|
s.add_runtime_dependency 'ed25519', '~> 1.2', '>= 1.2.4'
|
29
30
|
s.add_runtime_dependency 'ejson', '~> 1.2', '>= 1.2.1'
|
30
31
|
s.add_runtime_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_team
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt_pbkdf
|
@@ -50,6 +50,26 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.8.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: concurrent-ruby
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.1'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.1.7
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.1'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 1.1.7
|
53
73
|
- !ruby/object:Gem::Dependency
|
54
74
|
name: ed25519
|
55
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,22 +114,22 @@ dependencies:
|
|
94
114
|
name: net-ssh
|
95
115
|
requirement: !ruby/object:Gem::Requirement
|
96
116
|
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '6.1'
|
100
117
|
- - ">="
|
101
118
|
- !ruby/object:Gem::Version
|
102
119
|
version: 6.1.0
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '6.1'
|
103
123
|
type: :runtime
|
104
124
|
prerelease: false
|
105
125
|
version_requirements: !ruby/object:Gem::Requirement
|
106
126
|
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '6.1'
|
110
127
|
- - ">="
|
111
128
|
- !ruby/object:Gem::Version
|
112
129
|
version: 6.1.0
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '6.1'
|
113
133
|
- !ruby/object:Gem::Dependency
|
114
134
|
name: require_all
|
115
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,6 +172,7 @@ files:
|
|
152
172
|
- lib/builtin.rb
|
153
173
|
- lib/builtins/background.rb
|
154
174
|
- lib/builtins/background_log.rb
|
175
|
+
- lib/builtins/countdown.rb
|
155
176
|
- lib/builtins/down.rb
|
156
177
|
- lib/builtins/env.rb
|
157
178
|
- lib/builtins/envdiff.rb
|
@@ -205,9 +226,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
226
|
- !ruby/object:Gem::Version
|
206
227
|
version: '0'
|
207
228
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
229
|
+
rubygems_version: 3.0.3
|
209
230
|
signing_key:
|
210
231
|
specification_version: 4
|
211
|
-
summary: ops_team handles basic operations tasks for your project, driven by
|
212
|
-
config
|
232
|
+
summary: ops_team handles basic operations tasks for your project, driven by self-documenting
|
233
|
+
YAML config
|
213
234
|
test_files: []
|