opzworks 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83bf02242ab0c6ce1bbdada77d52bfe7950a0e2e
4
- data.tar.gz: 2c227652c0bfffb9d0a4ef31e87ddea8502332c8
3
+ metadata.gz: 510a2bf77a281bc4ee6b0190f370d17017138505
4
+ data.tar.gz: 7fcb46703b6fd09df705bd0772f416926f17ce96
5
5
  SHA512:
6
- metadata.gz: 1f53f15687081918bbd33d4f9a5a8ba309ddbee9df6532c4c015dd200ee71fb76775446f7921b254896ed3040a9235481ff24f4b00ee7208a289731d47cbc4f6
7
- data.tar.gz: 2e025f3a38effbe2ed4d783e37aee44bcf7761187acf8e19ddb2cf4b51682892f7f4793709fc79614b2d49eccd1d72f63870e61e5e8cbc82ea890011f02b94fc
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
- new_contents = "#{instances.join("\n")}\n" unless options[:raw]
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
- puts new_contents.strip unless options[:raw]
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
@@ -1,5 +1,5 @@
1
1
  module OpzWorks
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  AUTHORS = ['Grant Heffernan', 'Mapzen']
4
4
  EMAIL = ['grant@mapzen.com']
5
5
  DESCRIPTION = 'OpzWorks Utilities'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opzworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan