opswalrus 1.0.15 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +18 -1
- data/lib/opswalrus/app.rb +52 -18
- data/lib/opswalrus/bootstrap.sh +1 -0
- data/lib/opswalrus/bundler.rb +18 -34
- data/lib/opswalrus/cli.rb +24 -10
- data/lib/opswalrus/host.rb +21 -114
- data/lib/opswalrus/interaction_handlers.rb +17 -16
- data/lib/opswalrus/invocation.rb +71 -41
- data/lib/opswalrus/local_non_blocking_backend.rb +0 -1
- data/lib/opswalrus/operation_runner.rb +32 -17
- data/lib/opswalrus/ops_file.rb +3 -2
- data/lib/opswalrus/ops_file_script.rb +81 -10
- data/lib/opswalrus/ops_file_script_dsl.rb +13 -69
- data/lib/opswalrus/package_file.rb +11 -11
- data/lib/opswalrus/runtime_environment.rb +21 -41
- data/lib/opswalrus/version.rb +1 -1
- data/lib/opswalrus.rb +1 -1
- data/opswalrus.gemspec +4 -2
- metadata +30 -2
@@ -90,7 +90,7 @@ module OpsWalrus
|
|
90
90
|
str = "Namespace: #{@dirname.to_s}\n"
|
91
91
|
@symbol_table.each do |k, v|
|
92
92
|
if v.is_a? Namespace
|
93
|
-
str << "#{' ' * (indent)}|- #{k} : #{v.to_s(indent + 1)}
|
93
|
+
str << "#{' ' * (indent)}|- #{k} : #{v.to_s(indent + 1)}"
|
94
94
|
else
|
95
95
|
str << "#{' ' * (indent)}|- #{k} : #{v.to_s}\n"
|
96
96
|
end
|
@@ -106,31 +106,6 @@ module OpsWalrus
|
|
106
106
|
@symbol_table[symbol_name.to_s]
|
107
107
|
end
|
108
108
|
|
109
|
-
# # if this namespace contains an OpsFile of the same name as the namespace, e.g. pkg/install/install.ops, then this
|
110
|
-
# # method invokes the OpsFile of that same name and returns the result;
|
111
|
-
# # otherwise we return this namespace object
|
112
|
-
# def _invoke_if_namespace_has_ops_file_of_same_name(*args, **kwargs, &block)
|
113
|
-
# resolved_symbol = resolve_symbol(@dirname.basename)
|
114
|
-
# if resolved_symbol.is_a? OpsFile
|
115
|
-
# params_hash = resolved_symbol.build_params_hash(*args, **kwargs)
|
116
|
-
# resolved_symbol.invoke(runtime_env, params_hash)
|
117
|
-
# else
|
118
|
-
# self
|
119
|
-
# end
|
120
|
-
# end
|
121
|
-
|
122
|
-
# def method_missing(name, *args, **kwargs, &block)
|
123
|
-
# # puts "method_missing: #{name}"
|
124
|
-
# # puts caller
|
125
|
-
# resolved_symbol = resolve_symbol(name)
|
126
|
-
# case resolved_symbol
|
127
|
-
# when Namespace
|
128
|
-
# resolved_symbol._invoke_if_namespace_has_ops_file_of_same_name(*args, **kwargs)
|
129
|
-
# when OpsFile
|
130
|
-
# params_hash = resolved_symbol.build_params_hash(*args, **kwargs)
|
131
|
-
# resolved_symbol.invoke(runtime_env, params_hash)
|
132
|
-
# end
|
133
|
-
# end
|
134
109
|
end
|
135
110
|
|
136
111
|
# the assumption is that we have a bundle directory with all the packages in it
|
@@ -147,16 +122,13 @@ module OpsWalrus
|
|
147
122
|
@root_namespace = build_symbol_resolution_tree(@dir)
|
148
123
|
@path_map = build_path_map(@root_namespace)
|
149
124
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
# @path_map.each do |k,v|
|
158
|
-
# puts "#{k.to_s}: #{v.to_s}"
|
159
|
-
# end
|
125
|
+
App.instance.trace "LoadPath for #{@dir} ************************************************************"
|
126
|
+
App.instance.trace 'root namespace ******************************************************************'
|
127
|
+
App.instance.trace @root_namespace.to_s
|
128
|
+
App.instance.trace 'path map ************************************************************************'
|
129
|
+
@path_map.each do |k,v|
|
130
|
+
App.instance.trace "#{k.to_s}: #{v.to_s}"
|
131
|
+
end
|
160
132
|
|
161
133
|
@dynamic_package_additions_memo = {}
|
162
134
|
end
|
@@ -268,9 +240,16 @@ module OpsWalrus
|
|
268
240
|
@bundle_load_path = LoadPath.new(self, @app.bundle_dir)
|
269
241
|
@app_load_path = LoadPath.new(self, @app.pwd)
|
270
242
|
|
271
|
-
|
272
|
-
|
273
|
-
|
243
|
+
# we include this sudo password mapping by default because if a bundled script is being run on a remote host,
|
244
|
+
# then the remote command invocation will include the --pass flag when being run on the remote host, which will
|
245
|
+
# interactively prompt for a sudo password, and that will be the only opportunity for the command host
|
246
|
+
# that is running the bundled script on the remote host to interactively enter a sudo password for the remote context
|
247
|
+
# since the remote ops command will be running within a PTY, and the interactive prompts running on the remote
|
248
|
+
# host will be managed by the local ScopedMappingInteractionHandler running within the instance of the ops command
|
249
|
+
# process on the remote host, and the command host will not have any further opportunity to interactively enter
|
250
|
+
# any prompts on the remote host
|
251
|
+
interaction_handler_mapping_for_sudo_password = ScopedMappingInteractionHandler.mapping_for_sudo_password(sudo_password)
|
252
|
+
@interaction_handler = ScopedMappingInteractionHandler.new(interaction_handler_mapping_for_sudo_password)
|
274
253
|
|
275
254
|
configure_sshkit
|
276
255
|
end
|
@@ -291,6 +270,7 @@ module OpsWalrus
|
|
291
270
|
# SSHKit.config.use_format :simpletext
|
292
271
|
SSHKit.config.output_verbosity = :debug
|
293
272
|
elsif app.verbose?
|
273
|
+
SSHKit.config.use_format :pretty
|
294
274
|
# SSHKit.config.use_format :dot
|
295
275
|
SSHKit.config.output_verbosity = :info
|
296
276
|
end
|
@@ -344,8 +324,8 @@ module OpsWalrus
|
|
344
324
|
end.run
|
345
325
|
end
|
346
326
|
|
347
|
-
def invoke(ops_file,
|
348
|
-
ops_file.invoke(self,
|
327
|
+
def invoke(ops_file, hashlike_params)
|
328
|
+
ops_file.invoke(self, hashlike_params)
|
349
329
|
end
|
350
330
|
|
351
331
|
def find_load_path_that_includes_path(path)
|
data/lib/opswalrus/version.rb
CHANGED
data/lib/opswalrus.rb
CHANGED
data/opswalrus.gemspec
CHANGED
@@ -14,11 +14,11 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = "EPL-2.0"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
16
16
|
|
17
|
-
# spec.metadata["allowed_push_host"] = "
|
17
|
+
# spec.metadata["allowed_push_host"] = "Set to your gem server - https://example.com"
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
20
|
spec.metadata["source_code_uri"] = "https://github.com/opswalrus/opswalrus"
|
21
|
-
# spec.metadata["changelog_uri"] = "
|
21
|
+
# spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -37,7 +37,9 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency "gli", "~> 2.21"
|
38
38
|
spec.add_dependency "git", "~> 1.18"
|
39
39
|
spec.add_dependency "ougai", "~> 2.0"
|
40
|
+
spec.add_dependency "pastel", "~> 0.8"
|
40
41
|
spec.add_dependency "rubyzip", "~> 2.3"
|
42
|
+
spec.add_dependency "tty-editor", "~> 0.7"
|
41
43
|
|
42
44
|
spec.add_dependency "bcrypt_pbkdf", "~> 1.1"
|
43
45
|
spec.add_dependency "ed25519", "~> 1.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opswalrus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pastel
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rubyzip
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '2.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: tty-editor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.7'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.7'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: bcrypt_pbkdf
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|