opzworks 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/opzworks/commands/ssh.rb +24 -21
- data/lib/opzworks/meta.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 510a2bf77a281bc4ee6b0190f370d17017138505
|
4
|
+
data.tar.gz: 7fcb46703b6fd09df705bd0772f416926f17ce96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3006aae0997e648c83c2a3309eda0154f51c9ff8c6eef54521ee883f1cb13e79fb6cebd4cef18e9543149ab06f51b7b0dfb6d70388470bb1050526685d7ab418
|
7
|
+
data.tar.gz: 4a759fd871de073ccf0338ba9b712225b2661cafbf35566b501386bf40bb6cf13bfad2b6cb1aca95dc7344a85fb006cde62322be2d3a9572dddbe942d78726a9
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Run `opzworks` with one of the following commands:
|
|
30
30
|
|
31
31
|
#### ssh
|
32
32
|
|
33
|
-
Generate and update SSH configuration files.
|
33
|
+
Generate and update SSH configuration files, or alternatively return a list of IPs for matching stacks.
|
34
34
|
|
35
35
|
Host names are based off the stack naming convention, `project_name::env::region`. The default
|
36
36
|
is to use public instance IPs (or elastic ip if one is assigned). Passing the `--private` option
|
@@ -66,6 +66,10 @@ Add the following line to the bottom of your existing ~/.ssh/config:
|
|
66
66
|
|
67
67
|
`# OPSWORKS_CRON_LINE_MATCH`
|
68
68
|
|
69
|
+
To return only a list of IPs, pass the `--raw` flag:
|
70
|
+
|
71
|
+
`opzworks ssh -r mystack1 mystack2` or `opzworks ssh -r -p mystack`, etc.
|
72
|
+
|
69
73
|
#### elastic
|
70
74
|
|
71
75
|
Perform [start|stop|bounce|rolling] operations on an Elastic cluster.
|
@@ -76,28 +76,31 @@ module OpzWorks
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
if options[:update]
|
82
|
-
ssh_config = "#{ENV['HOME']}/.ssh/config"
|
83
|
-
old_contents = File.read(ssh_config)
|
84
|
-
|
85
|
-
if options[:backup]
|
86
|
-
backup_name = ssh_config + '.backup'
|
87
|
-
File.open(backup_name, 'w') { |file| file.puts old_contents }
|
88
|
-
end
|
89
|
-
|
90
|
-
File.open(ssh_config, 'w') do |file|
|
91
|
-
file.puts old_contents.gsub(
|
92
|
-
/\n?\n?#{SSH_PREFIX}.*#{SSH_POSTFIX}\n?\n?/m,
|
93
|
-
''
|
94
|
-
)
|
95
|
-
file.puts new_contents
|
96
|
-
end
|
97
|
-
|
98
|
-
puts "Successfully updated #{ssh_config} with #{instances.length} instances!"
|
79
|
+
if options[:raw]
|
80
|
+
next
|
99
81
|
else
|
100
|
-
|
82
|
+
new_contents = "#{instances.join("\n")}\n"
|
83
|
+
if options[:update]
|
84
|
+
ssh_config = "#{ENV['HOME']}/.ssh/config"
|
85
|
+
old_contents = File.read(ssh_config)
|
86
|
+
|
87
|
+
if options[:backup]
|
88
|
+
backup_name = ssh_config + '.backup'
|
89
|
+
File.open(backup_name, 'w') { |file| file.puts old_contents }
|
90
|
+
end
|
91
|
+
|
92
|
+
File.open(ssh_config, 'w') do |file|
|
93
|
+
file.puts old_contents.gsub(
|
94
|
+
/\n?\n?#{SSH_PREFIX}.*#{SSH_POSTFIX}\n?\n?/m,
|
95
|
+
''
|
96
|
+
)
|
97
|
+
file.puts new_contents
|
98
|
+
end
|
99
|
+
|
100
|
+
puts "Successfully updated #{ssh_config} with #{instances.length} instances!"
|
101
|
+
else
|
102
|
+
puts new_contents.strip
|
103
|
+
end
|
101
104
|
end
|
102
105
|
end
|
103
106
|
end
|
data/lib/opzworks/meta.rb
CHANGED