sonic-screwdriver 1.4.0 → 2.0.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/.circleci/bin/commit_docs.sh +26 -0
- data/.circleci/config.yml +70 -0
- data/.gitignore +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -2
- data/Gemfile +3 -3
- data/Gemfile.lock +43 -14
- data/Guardfile +17 -10
- data/LICENSE.txt +2 -2
- data/README.md +10 -10
- data/Rakefile +9 -2
- data/docs/_config.yml +3 -0
- data/docs/_docs/help.md +1 -1
- data/docs/_docs/install-bastion.md +5 -15
- data/docs/_docs/install.md +3 -3
- data/docs/_docs/settings.md +40 -56
- data/docs/_docs/tutorial-ecs-exec.md +16 -20
- data/docs/_docs/tutorial-ecs-sh.md +73 -0
- data/docs/_docs/tutorial-execute.md +93 -17
- data/docs/_docs/tutorial-ssh.md +13 -18
- data/docs/_docs/why-ec2-run-command.md +1 -1
- data/docs/_includes/commands.html +5 -5
- data/docs/_includes/content.html +5 -0
- data/docs/_includes/css/main.css +15 -9
- data/docs/_includes/css/sonic.css +7 -5
- data/docs/_includes/example.html +4 -4
- data/docs/_includes/reference.md +1 -0
- data/docs/_includes/subnav.html +2 -1
- data/docs/_reference/sonic-completion.md +44 -0
- data/docs/_reference/sonic-completion_script.md +25 -0
- data/docs/_reference/sonic-ecs-exec.md +30 -0
- data/docs/_reference/sonic-ecs-help.md +21 -0
- data/docs/_reference/sonic-ecs-sh.md +35 -0
- data/docs/_reference/sonic-ecs.md +25 -0
- data/docs/_reference/sonic-execute.md +84 -0
- data/docs/_reference/sonic-list.md +40 -0
- data/docs/_reference/sonic-ssh.md +86 -0
- data/docs/_reference/sonic-version.md +21 -0
- data/docs/img/tutorials/ec2-console-run-command.png +0 -0
- data/docs/quick-start.md +9 -10
- data/docs/reference.md +12 -0
- data/{bin → exe}/sonic +3 -3
- data/lib/bash_scripts/docker-exec.sh +1 -0
- data/lib/bash_scripts/docker-run.sh +8 -1
- data/lib/sonic.rb +10 -2
- data/lib/sonic/{aws_services.rb → aws_service.rb} +6 -1
- data/lib/sonic/base_command.rb +82 -0
- data/lib/sonic/cli.rb +37 -27
- data/lib/sonic/command.rb +8 -22
- data/lib/sonic/completer.rb +161 -0
- data/lib/sonic/completer/script.rb +6 -0
- data/lib/sonic/completer/script.sh +10 -0
- data/lib/sonic/core.rb +15 -0
- data/lib/sonic/default/settings.yml +6 -16
- data/lib/sonic/docker.rb +29 -1
- data/lib/sonic/ecs.rb +22 -0
- data/lib/sonic/execute.rb +153 -18
- data/lib/sonic/help.rb +9 -0
- data/lib/sonic/help/command/send.md +10 -0
- data/lib/sonic/help/completion.md +22 -0
- data/lib/sonic/help/completion_script.md +3 -0
- data/lib/sonic/help/ecs/exec.md +8 -0
- data/lib/sonic/help/ecs/sh.md +13 -0
- data/lib/sonic/help/execute.md +60 -0
- data/lib/sonic/help/list.md +17 -0
- data/lib/sonic/help/ssh.md +60 -0
- data/lib/sonic/list.rb +4 -1
- data/lib/sonic/setting.rb +47 -0
- data/lib/sonic/ssh.rb +41 -20
- data/lib/sonic/ssh/identifier_detector.rb +6 -2
- data/lib/sonic/version.rb +1 -1
- data/sonic.gemspec +14 -9
- data/spec/lib/cli_spec.rb +5 -10
- data/spec/lib/sonic/execute_spec.rb +0 -1
- data/spec/spec_helper.rb +18 -10
- metadata +115 -16
- data/docs/_docs/tutorial-ecs-run.md +0 -100
- data/lib/sonic/cli/help.rb +0 -152
- data/lib/sonic/settings.rb +0 -115
data/lib/sonic/settings.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Sonic
|
4
|
-
class Settings
|
5
|
-
def initialize(project_root=nil)
|
6
|
-
@project_root = project_root || '.'
|
7
|
-
end
|
8
|
-
|
9
|
-
def data
|
10
|
-
return @data if @data
|
11
|
-
|
12
|
-
project_file = "#{@project_root}/.sonic/settings.yml"
|
13
|
-
project = File.exist?(project_file) ? YAML.load_file(project_file) : {}
|
14
|
-
|
15
|
-
user_file = "#{home}/.sonic/settings.yml"
|
16
|
-
user = File.exist?(user_file) ? YAML.load_file(user_file) : {}
|
17
|
-
|
18
|
-
default_file = File.expand_path("../default/settings.yml", __FILE__)
|
19
|
-
default = YAML.load_file(default_file)
|
20
|
-
|
21
|
-
@data = default.merge(user.merge(project))
|
22
|
-
ensure_default_cluster!(@data)
|
23
|
-
ensure_default_bastion!(data)
|
24
|
-
@data
|
25
|
-
end
|
26
|
-
|
27
|
-
# Public: Returns default cluster based on the ECS service name.
|
28
|
-
#
|
29
|
-
# service - ECS service
|
30
|
-
# count - The Integer number of times to duplicate the text.
|
31
|
-
#
|
32
|
-
# The settings.yml format:
|
33
|
-
#
|
34
|
-
# service_cluster:
|
35
|
-
# default: stag
|
36
|
-
# hi-web-prod: prod
|
37
|
-
# hi-clock-prod: prod
|
38
|
-
# hi-worker-prod: prod
|
39
|
-
# hi-web-stag: stag
|
40
|
-
# hi-clock-stag: stag
|
41
|
-
# hi-worker-stag: stag
|
42
|
-
#
|
43
|
-
# Examples
|
44
|
-
#
|
45
|
-
# default_cluster('hi-web-prod')
|
46
|
-
# # => 'prod'
|
47
|
-
# default_cluster('whatever')
|
48
|
-
# # => 'stag'
|
49
|
-
#
|
50
|
-
# Returns the ECS cluster name.
|
51
|
-
def default_cluster(service)
|
52
|
-
service_cluster = data["service_cluster"]
|
53
|
-
service_cluster[service] || service_cluster["default"]
|
54
|
-
end
|
55
|
-
|
56
|
-
# When user's .sonic/settings.yml lack the default cluster, we add it on.
|
57
|
-
# Otherwise the user get confusing and scary aws-sdk-core/param_validator errors:
|
58
|
-
# Example: https://gist.github.com/sonic/67b9a68a77363b908d1c36047bc2709a
|
59
|
-
def ensure_default_cluster!(data)
|
60
|
-
unless data["service_cluster"]["default"]
|
61
|
-
data["service_cluster"]["default"] = "default"
|
62
|
-
end
|
63
|
-
data
|
64
|
-
end
|
65
|
-
|
66
|
-
# Public: Returns default bastion host.
|
67
|
-
#
|
68
|
-
# cluster - cluster provided by user
|
69
|
-
#
|
70
|
-
# The settings.yml format:
|
71
|
-
#
|
72
|
-
# bastion:
|
73
|
-
# default: bastion.mydomain.com
|
74
|
-
# prod: bastion.mydomain.com
|
75
|
-
# stag: bastion-stag.mydomain.com
|
76
|
-
#
|
77
|
-
# Examples
|
78
|
-
#
|
79
|
-
# default_bastion('stag')
|
80
|
-
# # => 'bastion-stag.mydomain.com'
|
81
|
-
# default_bastion('whatever')
|
82
|
-
# # => 'bastion.mydomain.com'
|
83
|
-
#
|
84
|
-
# Returns the bastion host that is mapped to the cluster
|
85
|
-
def default_bastion(cluster)
|
86
|
-
bastion = data["bastion"]
|
87
|
-
bastion[cluster] || bastion["default"]
|
88
|
-
end
|
89
|
-
|
90
|
-
# When user's .sonic/settings.yml lack the default cluster, we add it on.
|
91
|
-
def ensure_default_bastion!(data)
|
92
|
-
unless data["bastion"] && data["bastion"].has_key?("default")
|
93
|
-
data["bastion"] ||= {}
|
94
|
-
data["bastion"]["default"] = nil
|
95
|
-
end
|
96
|
-
data
|
97
|
-
end
|
98
|
-
|
99
|
-
# By default bypass strict host key checking for convenience.
|
100
|
-
# But user can overrride this.
|
101
|
-
def host_key_check_options
|
102
|
-
if data["host_key_check"] == true
|
103
|
-
[]
|
104
|
-
else
|
105
|
-
# disables host key checking
|
106
|
-
%w[-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null]
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def home
|
111
|
-
# hack but fast
|
112
|
-
ENV['TEST'] ? "spec/fixtures/home" : ENV['HOME']
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|