eac_tools 0.103.0 → 0.103.1
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.lock +22 -27
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +1 -1
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/apache_host.rb +0 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/database.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/files.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/gitolite.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/install.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/nodejs.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/web.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +1 -7
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +0 -6
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/project.rb +0 -5
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/root.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/wiki_page.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/docker.rb +0 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb +0 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/write.rb +0 -2
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project_rename.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/core_update.rb +0 -6
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/core_update.rb +0 -4
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/docker.rb +0 -3
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
- data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +1 -0
- data/sub/eac_cli/eac_cli.gemspec +23 -0
- data/sub/eac_cli/lib/eac_cli/config/entry/options.rb +55 -0
- data/sub/eac_cli/lib/eac_cli/config/entry/undefined.rb +26 -0
- data/sub/eac_cli/lib/eac_cli/config/entry.rb +55 -0
- data/sub/eac_cli/lib/eac_cli/config.rb +15 -0
- data/sub/eac_cli/lib/eac_cli/core_ext.rb +4 -0
- data/sub/eac_cli/lib/eac_cli/default_runner.rb +12 -0
- data/sub/eac_cli/lib/eac_cli/definition/alternative.rb +101 -0
- data/sub/eac_cli/lib/eac_cli/definition/argument_option.rb +19 -0
- data/sub/eac_cli/lib/eac_cli/definition/boolean_option.rb +25 -0
- data/sub/eac_cli/lib/eac_cli/definition/error.rb +8 -0
- data/sub/eac_cli/lib/eac_cli/definition/option/initialize_args_parser.rb +48 -0
- data/sub/eac_cli/lib/eac_cli/definition/option.rb +70 -0
- data/sub/eac_cli/lib/eac_cli/definition/option_or_positional.rb +41 -0
- data/sub/eac_cli/lib/eac_cli/definition/positional.rb +50 -0
- data/sub/eac_cli/lib/eac_cli/definition.rb +104 -0
- data/sub/eac_cli/lib/eac_cli/enum.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +76 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/password_entry_reader.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/old_configs/store_passwords_entry_reader.rb +23 -0
- data/sub/eac_cli/lib/eac_cli/old_configs.rb +31 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/any_options.rb +17 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/argv.rb +19 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +37 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/options.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/parser/alternative.rb +99 -0
- data/sub/eac_cli/lib/eac_cli/parser/collector.rb +52 -0
- data/sub/eac_cli/lib/eac_cli/parser/error.rb +13 -0
- data/sub/eac_cli/lib/eac_cli/parser.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/patches/object/runner_with.rb +22 -0
- data/sub/eac_cli/lib/eac_cli/patches/object.rb +5 -0
- data/sub/eac_cli/lib/eac_cli/patches.rb +3 -0
- data/sub/eac_cli/lib/eac_cli/rspec/setup.rb +41 -0
- data/sub/eac_cli/lib/eac_cli/rspec.rb +7 -0
- data/sub/eac_cli/lib/eac_cli/runner/after_class_methods.rb +34 -0
- data/sub/eac_cli/lib/eac_cli/runner/class_runner.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/runner/context.rb +57 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/base.rb +22 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/parent.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner.rb +17 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/runner_missing_method.rb +29 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders/set.rb +41 -0
- data/sub/eac_cli/lib/eac_cli/runner/context_responders.rb +9 -0
- data/sub/eac_cli/lib/eac_cli/runner/exit.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/runner/for_context.rb +35 -0
- data/sub/eac_cli/lib/eac_cli/runner/instance_methods.rb +45 -0
- data/sub/eac_cli/lib/eac_cli/runner.rb +47 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/confirmation/input_result.rb +60 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/confirmation.rb +65 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder/alternative.rb +61 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +79 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +38 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +51 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +32 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/asciidoc_formatter.rb +70 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/base_formatter.rb +12 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/csv_formatter.rb +21 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +16 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_item.rb +47 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/base_formatter.rb +44 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/csv_formatter.rb +24 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/tty_formatter.rb +34 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list/yaml_formatter.rb +21 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/output_list.rb +39 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands/definition_concern.rb +10 -0
- data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +124 -0
- data/sub/eac_cli/lib/eac_cli/runner_with.rb +7 -0
- data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +54 -0
- data/sub/eac_cli/lib/eac_cli/speaker/constants.rb +11 -0
- data/sub/eac_cli/lib/eac_cli/speaker/input_blocked.rb +14 -0
- data/sub/eac_cli/lib/eac_cli/speaker/input_requested.rb +8 -0
- data/sub/eac_cli/lib/eac_cli/speaker/list.rb +84 -0
- data/sub/eac_cli/lib/eac_cli/speaker/options.rb +42 -0
- data/sub/eac_cli/lib/eac_cli/speaker/request_from_list.rb +40 -0
- data/sub/eac_cli/lib/eac_cli/speaker.rb +114 -0
- data/sub/eac_cli/lib/eac_cli/version.rb +5 -0
- data/sub/eac_cli/lib/eac_cli.rb +14 -0
- data/sub/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +18 -0
- data/sub/eac_cli/spec/lib/eac_cli/old_configs_spec.rb +14 -0
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative/subcommands_spec.rb +58 -0
- data/sub/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +89 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner/for_context_spec.rb +79 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_spec.rb +129 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation/input_result_spec.rb +36 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb +42 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +21 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +51 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_list_spec.rb +57 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/output_spec.rb +81 -0
- data/sub/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +99 -0
- data/sub/eac_cli/spec/lib/eac_cli/speaker_spec.rb +36 -0
- data/sub/{eac_docker → eac_cli}/spec/spec_helper.rb +1 -2
- metadata +108 -48
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners.rb +0 -14
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances.rb +0 -11
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners.rb +0 -13
- data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources.rb +0 -11
- data/sub/avm-eac_ubuntu_base0/avm-eac_ubuntu_base0.gemspec +0 -21
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache/resource.rb +0 -57
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/apache.rb +0 -24
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/docker_image.rb +0 -31
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb +0 -24
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/rspec/ssh_docker_server.rb +0 -82
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base/docker.rb +0 -15
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/runners/base.rb +0 -26
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +0 -7
- data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0.rb +0 -13
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/docker_image_spec.rb +0 -12
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/rspec/ssh_docker_server_spec.rb +0 -11
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base/docker_spec.rb +0 -11
- data/sub/avm-eac_ubuntu_base0/spec/lib/avm/eac_ubuntu_base0/runners/base_spec.rb +0 -5
- data/sub/avm-eac_ubuntu_base0/spec/spec_helper.rb +0 -5
- data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/docker_image/Dockerfile.template +0 -27
- data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/Dockerfile.template +0 -24
- data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/id_rsa +0 -27
- data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/id_rsa.pub +0 -1
- data/sub/eac_docker/Gemfile +0 -8
- data/sub/eac_docker/eac_docker.gemspec +0 -20
- data/sub/eac_docker/lib/eac_docker/container.rb +0 -83
- data/sub/eac_docker/lib/eac_docker/debug.rb +0 -13
- data/sub/eac_docker/lib/eac_docker/executables.rb +0 -15
- data/sub/eac_docker/lib/eac_docker/images/base.rb +0 -11
- data/sub/eac_docker/lib/eac_docker/images/coded.rb +0 -39
- data/sub/eac_docker/lib/eac_docker/images/named.rb +0 -26
- data/sub/eac_docker/lib/eac_docker/images/templatized.rb +0 -43
- data/sub/eac_docker/lib/eac_docker/registry.rb +0 -15
- data/sub/eac_docker/lib/eac_docker/rspec/setup.rb +0 -15
- data/sub/eac_docker/lib/eac_docker/rspec/stub_image.rb +0 -39
- data/sub/eac_docker/lib/eac_docker/version.rb +0 -5
- data/sub/eac_docker/lib/eac_docker.rb +0 -9
- data/sub/eac_docker/spec/lib/eac_docker/executables_spec.rb +0 -7
- data/sub/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +0 -10
- data/sub/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +0 -1
- data/sub/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +0 -15
- data/sub/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +0 -1
- data/sub/eac_docker/spec/rubocop_spec.rb +0 -3
- /data/sub/{avm-eac_ubuntu_base0 → eac_cli}/Gemfile +0 -0
- /data/sub/{avm-eac_ubuntu_base0 → eac_cli}/spec/rubocop_spec.rb +0 -0
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
-
|
5
|
-
require 'avm/eac_ubuntu_base0/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = 'avm-eac_ubuntu_base0'
|
9
|
-
s.version = Avm::EacUbuntuBase0::VERSION
|
10
|
-
s.authors = ['Put here the authors']
|
11
|
-
s.summary = 'Put here de description.'
|
12
|
-
|
13
|
-
s.files = Dir['{lib,template}/**/*']
|
14
|
-
s.required_ruby_version = '>= 2.7'
|
15
|
-
|
16
|
-
s.add_dependency 'avm', '~> 0.97'
|
17
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.128', '>= 0.128.3'
|
18
|
-
s.add_dependency 'eac_templates', '~> 0.8', '>= 0.8.1'
|
19
|
-
|
20
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.12'
|
21
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
class Apache
|
6
|
-
class Resource
|
7
|
-
common_constructor :apache, :type, :directory_prefix, :name
|
8
|
-
|
9
|
-
def available_path
|
10
|
-
::File.join(apache.etc_root, "#{directory_prefix}-available", "#{name}.conf")
|
11
|
-
end
|
12
|
-
|
13
|
-
def available?
|
14
|
-
apache.host_env.file(available_path).exist?
|
15
|
-
end
|
16
|
-
|
17
|
-
def disable
|
18
|
-
apache.host_env.command('sudo', "a2dis#{type}", name).execute!
|
19
|
-
end
|
20
|
-
|
21
|
-
def enable
|
22
|
-
apache.host_env.command('sudo', "a2en#{type}", name).execute!
|
23
|
-
end
|
24
|
-
|
25
|
-
def enabled_path
|
26
|
-
::File.join(apache.etc_root, "#{directory_prefix}-enabled", "#{name}.conf")
|
27
|
-
end
|
28
|
-
|
29
|
-
def enabled?
|
30
|
-
apache.host_env.file(enabled_path).exist?
|
31
|
-
end
|
32
|
-
|
33
|
-
def remove
|
34
|
-
remove_disabled
|
35
|
-
remove_available
|
36
|
-
end
|
37
|
-
|
38
|
-
def remove_available
|
39
|
-
raise 'Remove enabled before' if enabled?
|
40
|
-
|
41
|
-
apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available?
|
42
|
-
end
|
43
|
-
|
44
|
-
def remove_disabled
|
45
|
-
disable if enabled?
|
46
|
-
apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled?
|
47
|
-
end
|
48
|
-
|
49
|
-
def write(content)
|
50
|
-
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
51
|
-
apache.host_env.command('sudo', 'tee', available_path)
|
52
|
-
).execute!
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
class Apache
|
6
|
-
require_sub __FILE__
|
7
|
-
common_constructor :host_env
|
8
|
-
|
9
|
-
def etc_root
|
10
|
-
'/etc/apache2'
|
11
|
-
end
|
12
|
-
|
13
|
-
def service(command)
|
14
|
-
host_env.command('sudo', 'service', 'apache2', command)
|
15
|
-
end
|
16
|
-
|
17
|
-
{ conf: :conf, site: :sites }.each do |type, directory_prefix|
|
18
|
-
define_method type do |name|
|
19
|
-
::Avm::EacUbuntuBase0::Apache::Resource.new(self, type, directory_prefix, name)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
class DockerImage < ::Avm::Docker::Image
|
6
|
-
BASE_IMAGE = 'ubuntu:24.04'
|
7
|
-
USER_NAME = 'myuser'
|
8
|
-
|
9
|
-
# @return [String]
|
10
|
-
def base_image
|
11
|
-
BASE_IMAGE
|
12
|
-
end
|
13
|
-
|
14
|
-
def stereotype_tag
|
15
|
-
'eac_ubuntu_base0'
|
16
|
-
end
|
17
|
-
|
18
|
-
def user_home
|
19
|
-
::File.join('/home', user_name)
|
20
|
-
end
|
21
|
-
|
22
|
-
def user_name
|
23
|
-
USER_NAME
|
24
|
-
end
|
25
|
-
|
26
|
-
def user_password
|
27
|
-
user_name
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
module Instances
|
6
|
-
class Base < ::Avm::Instances::Base
|
7
|
-
# @return [Avm::EacUbuntuBase0::Apache]
|
8
|
-
def apache
|
9
|
-
::Avm::EacUbuntuBase0::Apache.new(host_env)
|
10
|
-
end
|
11
|
-
|
12
|
-
def docker_image_class
|
13
|
-
::Avm::EacUbuntuBase0::DockerImage
|
14
|
-
end
|
15
|
-
|
16
|
-
def file_sudo_write(path, content)
|
17
|
-
::EacRubyUtils::Envs.local.command('echo', content).pipe(
|
18
|
-
host_env.command('sudo', 'tee', path)
|
19
|
-
).execute!
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
module Rspec
|
6
|
-
class SshDockerServer < ::EacDocker::Images::Templatized
|
7
|
-
def base_image
|
8
|
-
::Avm::EacUbuntuBase0::DockerImage::BASE_IMAGE
|
9
|
-
end
|
10
|
-
|
11
|
-
# @return [EacRubyUtils::Envs::SshEnv]
|
12
|
-
def env
|
13
|
-
raise '@env is blank' if @env.blank?
|
14
|
-
|
15
|
-
@env
|
16
|
-
end
|
17
|
-
|
18
|
-
def on_run(&block)
|
19
|
-
on_container do
|
20
|
-
on_env(&block)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def container
|
27
|
-
raise '@container is blank' if @container.blank?
|
28
|
-
|
29
|
-
@container
|
30
|
-
end
|
31
|
-
|
32
|
-
def env_identity_file
|
33
|
-
template.child('id_rsa').path
|
34
|
-
end
|
35
|
-
|
36
|
-
def env_identity_file_good_permissions
|
37
|
-
r = ::EacRubyUtils::Fs::Temp.file
|
38
|
-
::FileUtils.cp env_identity_file, r
|
39
|
-
r.chmod(0o600)
|
40
|
-
r
|
41
|
-
end
|
42
|
-
|
43
|
-
def close_env
|
44
|
-
@identity_file.remove
|
45
|
-
@env = nil
|
46
|
-
end
|
47
|
-
|
48
|
-
def on_env
|
49
|
-
open_env
|
50
|
-
begin
|
51
|
-
yield
|
52
|
-
ensure
|
53
|
-
close_env
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def on_container
|
58
|
-
provide.container.temporary(true).on_detached do |container|
|
59
|
-
@container = container
|
60
|
-
begin
|
61
|
-
yield
|
62
|
-
ensure
|
63
|
-
@container = nil
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def open_env
|
69
|
-
raise 'Environment already open' if @env.present?
|
70
|
-
|
71
|
-
@identity_file = env_identity_file_good_permissions
|
72
|
-
@env = ::EacRubyUtils::Envs::SshEnv.new(
|
73
|
-
"ssh://root@#{container.hostname}" \
|
74
|
-
'?StrictHostKeyChecking=no' \
|
75
|
-
'&BatchMode=yes' \
|
76
|
-
"&IdentityFile=#{@identity_file}"
|
77
|
-
)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Avm
|
4
|
-
module EacUbuntuBase0
|
5
|
-
module Runners
|
6
|
-
class Base < ::Avm::Runners::Base
|
7
|
-
enable_simple_cache
|
8
|
-
require_sub __FILE__
|
9
|
-
|
10
|
-
INSTANCE_ID = 'eac-ubuntu-base0_self'
|
11
|
-
|
12
|
-
runner_with :help, :subcommands do
|
13
|
-
subcommands
|
14
|
-
end
|
15
|
-
|
16
|
-
for_context :instance
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def instance_uncached
|
21
|
-
::Avm::EacUbuntuBase0::Instances::Base.by_id(INSTANCE_ID)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Avm::EacUbuntuBase0::DockerImage do
|
4
|
-
let(:registry) { EacDocker::Registry.new('stub') }
|
5
|
-
let(:instance) { described_class.new(registry) }
|
6
|
-
|
7
|
-
describe '#provide' do
|
8
|
-
it do
|
9
|
-
expect(instance.provide).to be_a(EacDocker::Images::Base)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Avm::EacUbuntuBase0::Runners::Base::Docker do
|
4
|
-
it do
|
5
|
-
expect { run_command('--registry-name', 'testing', '--image-name') }.not_to raise_error
|
6
|
-
end
|
7
|
-
|
8
|
-
def run_command(*argv)
|
9
|
-
Avm::EacUbuntuBase0::Runners::Base.run(argv: %w[docker] + argv)
|
10
|
-
end
|
11
|
-
end
|
data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/docker_image/Dockerfile.template
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
FROM %%base_image%%
|
2
|
-
|
3
|
-
# Base system update
|
4
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
5
|
-
RUN apt-get update -y
|
6
|
-
RUN apt-get dist-upgrade -y
|
7
|
-
|
8
|
-
# Timezone
|
9
|
-
RUN apt-get install -y tzdata
|
10
|
-
RUN ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
|
11
|
-
RUN dpkg-reconfigure --frontend noninteractive tzdata
|
12
|
-
|
13
|
-
# Default user
|
14
|
-
RUN /usr/sbin/groupmod --new-name '%%user_name%%' ubuntu
|
15
|
-
RUN /usr/sbin/usermod --shell /bin/bash --home %%user_home%% --move-home --login %%user_name%% \
|
16
|
-
ubuntu
|
17
|
-
RUN /bin/echo '%%user_name%%:%%user_password%%' | /usr/sbin/chpasswd
|
18
|
-
RUN /bin/chown %%user_name%%:%%user_name%% %%user_home%% -R
|
19
|
-
|
20
|
-
# Sudo
|
21
|
-
RUN apt-get install -y sudo
|
22
|
-
RUN /bin/echo "%%user_name%% ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/%%user_name%%_all_nopasswd && chmod 0440 /etc/sudoers.d/%%user_name%%_all_nopasswd
|
23
|
-
|
24
|
-
# Container
|
25
|
-
USER %%user_name%%
|
26
|
-
WORKDIR %%user_home%%
|
27
|
-
CMD /bin/bash
|
@@ -1,24 +0,0 @@
|
|
1
|
-
FROM '%%base_image%%'
|
2
|
-
MAINTAINER Aleksandar Diklic "https://github.com/rastasheep"
|
3
|
-
|
4
|
-
RUN apt-get update
|
5
|
-
|
6
|
-
RUN apt-get install -y openssh-server
|
7
|
-
RUN mkdir /var/run/sshd
|
8
|
-
|
9
|
-
RUN echo 'root:root' |chpasswd
|
10
|
-
|
11
|
-
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
|
12
|
-
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
|
13
|
-
|
14
|
-
RUN mkdir -p /root/.ssh
|
15
|
-
ADD id_rsa /root/.ssh/id_rsa
|
16
|
-
ADD id_rsa.pub /root/.ssh/id_rsa.pub
|
17
|
-
ADD id_rsa.pub /root/.ssh/authorized_keys
|
18
|
-
|
19
|
-
RUN apt-get clean && \
|
20
|
-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
21
|
-
|
22
|
-
EXPOSE 22
|
23
|
-
|
24
|
-
CMD ["/usr/sbin/sshd", "-D"]
|
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEowIBAAKCAQEAyZfl6Z+r/Is396PdKgYEWAf0O2xt7a1UwlaP7ozRvZjmmd/X
|
3
|
-
dkPo2ZsXe7tACAJzDHMO9UO1/WQ0ZirkVfLTe82CInwggYLxEf1vRtCV1NuVtttZ
|
4
|
-
+D0yZWb/kXEApVAIzKvCBPZJuspBPuJcEuVygJn646WXqi1X3CBDqV+YEI8sm1o3
|
5
|
-
xn9xmsyXmW7AfIT07F1W6u4/vfGnZ3zjyXwA0ef1wZ46RgzFgVTBZOnpf0ELjcW0
|
6
|
-
VRfvgGRytoY22pvqxtYc5Yumgddp2oi3fUKMoRrDAwU7+VFKUQv0XmMsZKKp2iei
|
7
|
-
hl/WRI9ScXs16QNQZqVqnw9ll2aUaPVVf1Jk4QIDAQABAoIBADDiWKoyQe5XhBbU
|
8
|
-
8YiDNQJzy1GtlWqRIYCOpRBfrWygayrdEM5o4UoDRcqHOZu3nFZkgDgRV0w+xEYS
|
9
|
-
GJSO8aGP0AK0vt0o93Q5VIaDhhG7va49uq9rh5D3TPnjwRhVNA0NiVrSrkZRTUkG
|
10
|
-
cvVSFlYBAMm7Ge/2VtvWJxInUCSTZPZfh+7ySAOYfDCpENgEcQKYXhx2WFrd0O/Q
|
11
|
-
I2QgIpbpOAgqNxvaRT60gNiIKmIGAFHEJiKsK94mkaVj28GJ4kZkXkdaGQDuypYp
|
12
|
-
nB7sO3Z5Gq2pCjAgFHxtDP2lZHN4IaX6uQBWupCPhJ63V9gLTvxTMZfI9sn6O2PS
|
13
|
-
F50wQcECgYEA88o22sA5ZoEZ7CtXVZ9EzNOopNMFNX4IeMdu7c8+qgZWWFJDbmXV
|
14
|
-
AqDZ0W72miSETZB8FR9unJLXlgBJWSR7R4s6KfTo9PKvfN3x0H3l+4AZXcDTexJN
|
15
|
-
vdYWJbR+NnsW3lh5dzBiRE70GQ2QU9zQKMl9mCWVL+3o1YAz9XqTYKUCgYEA07Cn
|
16
|
-
rPLHUQvmm4+DUlyNp8H0SBWl0jx1+cMnfWpdMMs/7bLYpkbnpqN/IgKQOf3AYI//
|
17
|
-
lncnk1NRdNfpuf3yLtvhdqZFg9N11dbT0i0rTNlHvWzrVB4Rtu9OD3EWvCoqOPKQ
|
18
|
-
ey+XdVyasI8W6k4hYuZiClsm2pFwxbTMBBTbYo0CgYAuQMVbh3Dcg835QtfVBNy2
|
19
|
-
x8mNTAQG/Bx7XcssD0/iTkV/iEwG3Acn8oCg/Z6H7Dm1xZ3lHAuOZUXFzdQct5E0
|
20
|
-
J7QnVbIFFy44UJuaZOiHaOxnHziAdx6Mz9tv1+jCSWQzVzHkbSeXsisZvbsOTiyo
|
21
|
-
MGJFxYuihk7QgvxYrKLdiQKBgGb/aeYFTiNJ5g9EWYHmVGoOPZwhJEhRcJlwcbNc
|
22
|
-
4DDQg69UuILWtvlmTYIvuxrsMwEIrzP3j8Ln5Bc0wpzjSUWxaFcBeYs1hPzhhLib
|
23
|
-
j5jZk0VATJPl+XqHnvR2crhkz5xbsR6uvkO1JfLH/D9OeoITVBpz1Ui9QSCA4k8O
|
24
|
-
Etw1AoGBAKRMXd+BxObb7+Qr0QSSjsAo2/5Ca782X1G8LoXkKqXqSiY+Y98ugpoC
|
25
|
-
Gu+oeiHLHDW47hHbtC5rdXigcLEZQRiLVsOiwgua8AcnQxBhF4/Xi877+C8hB7ge
|
26
|
-
JjlolpGpvjYN3QEnYxki4Fbgxxz4PX91NjnT5RF4dILhTa5kavP7
|
27
|
-
-----END RSA PRIVATE KEY-----
|
data/sub/avm-eac_ubuntu_base0/template/avm/eac_ubuntu_base0/rspec/ssh_docker_server/id_rsa.pub
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJl+Xpn6v8izf3o90qBgRYB/Q7bG3trVTCVo/ujNG9mOaZ39d2Q+jZmxd7u0AIAnMMcw71Q7X9ZDRmKuRV8tN7zYIifCCBgvER/W9G0JXU25W221n4PTJlZv+RcQClUAjMq8IE9km6ykE+4lwS5XKAmfrjpZeqLVfcIEOpX5gQjyybWjfGf3GazJeZbsB8hPTsXVbq7j+98adnfOPJfADR5/XBnjpGDMWBVMFk6el/QQuNxbRVF++AZHK2hjbam+rG1hzli6aB12naiLd9QoyhGsMDBTv5UUpRC/ReYyxkoqnaJ6KGX9ZEj1JxezXpA1BmpWqfD2WXZpRo9VV/UmTh avm@localhost
|
data/sub/eac_docker/Gemfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
-
|
5
|
-
require 'eac_docker/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = 'eac_docker'
|
9
|
-
s.version = EacDocker::VERSION
|
10
|
-
s.authors = ['Put here the authors']
|
11
|
-
s.summary = 'Put here de description.'
|
12
|
-
|
13
|
-
s.files = Dir['{lib}/**/*']
|
14
|
-
s.required_ruby_version = '>= 2.7'
|
15
|
-
|
16
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.128', '>= 0.128.2'
|
17
|
-
s.add_dependency 'eac_templates', '~> 0.8', '>= 0.8.1'
|
18
|
-
|
19
|
-
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.12'
|
20
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module EacDocker
|
4
|
-
class Container
|
5
|
-
enable_immutable
|
6
|
-
immutable_accessor :interactive, :temporary, :tty, type: :boolean
|
7
|
-
immutable_accessor :env, type: :hash
|
8
|
-
immutable_accessor :capability, :command_arg, :volume, type: :array
|
9
|
-
attr_reader :id
|
10
|
-
|
11
|
-
common_constructor :image
|
12
|
-
|
13
|
-
def immutable_constructor_args
|
14
|
-
[image]
|
15
|
-
end
|
16
|
-
|
17
|
-
alias immutable_volume volume
|
18
|
-
|
19
|
-
def hostname
|
20
|
-
::EacDocker::Executables.docker.command(
|
21
|
-
'inspect', '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
|
22
|
-
id
|
23
|
-
).execute!.strip
|
24
|
-
end
|
25
|
-
|
26
|
-
# @return [String]
|
27
|
-
def logs
|
28
|
-
::EacDocker::Executables.docker.command('logs', id).execute!
|
29
|
-
end
|
30
|
-
|
31
|
-
def on_detached
|
32
|
-
command = ::EacDocker::Executables.docker.command(*(%w[run --detach] + run_command_args))
|
33
|
-
self.id = command.execute!.strip
|
34
|
-
begin
|
35
|
-
yield(self)
|
36
|
-
ensure
|
37
|
-
stop
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def volume(left_part, right_part = nil)
|
42
|
-
immutable_volume(right_part.if_present(left_part) { |v| "#{left_part}:#{v}" })
|
43
|
-
end
|
44
|
-
|
45
|
-
def run_command
|
46
|
-
::EacDocker::Executables.docker.command('run', *run_command_args)
|
47
|
-
end
|
48
|
-
|
49
|
-
def run_command_args
|
50
|
-
%w[boolean capabilities envs volumes]
|
51
|
-
.inject([]) { |a, e| a + send("run_command_#{e}_args") } +
|
52
|
-
[image.provide.id] + command_args
|
53
|
-
end
|
54
|
-
|
55
|
-
def stop
|
56
|
-
::EacDocker::Executables.docker.command('stop', id).execute!
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
attr_writer :id
|
62
|
-
|
63
|
-
def run_command_boolean_args
|
64
|
-
r = []
|
65
|
-
r << '--interactive' if interactive?
|
66
|
-
r << '--tty' if tty?
|
67
|
-
r << '--rm' if temporary?
|
68
|
-
r
|
69
|
-
end
|
70
|
-
|
71
|
-
def run_command_capabilities_args
|
72
|
-
capabilities.flat_map { |capability| ['--cap-add', capability] }
|
73
|
-
end
|
74
|
-
|
75
|
-
def run_command_volumes_args
|
76
|
-
volumes.flat_map { |volume| ['--volume', volume] }
|
77
|
-
end
|
78
|
-
|
79
|
-
def run_command_envs_args
|
80
|
-
envs.flat_map { |name, value| ['--env', "#{name}=#{value}"] }
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|