td 0.10.41 → 0.10.42

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.
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ == 2012-09-04 version 0.10.42
3
+
4
+ * Added user:password:change subcomamnd
5
+
6
+
2
7
  == 2012-08-30 version 0.10.41
3
8
 
4
9
  * Supports HTTP_PROXY environemnt variable to use a proxy server
@@ -277,6 +277,7 @@ module List
277
277
  add_list 'user:create', %w[name], 'Create an user'
278
278
  add_list 'user:delete', %w[name], 'Delete an user'
279
279
  add_list 'user:apikey:list', %w[name], 'Show API keys'
280
+ add_list 'user:password:change', %w[name], 'Change password'
280
281
 
281
282
  add_list 'role:list', %w[], 'Show list of roles'
282
283
  add_list 'role:show', %w[name], 'Show a role'
@@ -178,9 +178,56 @@ module Command
178
178
  puts cmd_render_table(rows, :fields => [:Key])
179
179
  end
180
180
 
181
- ## TODO user:password:change <name>
182
- #def user_password_change(op)
183
- #end
181
+ def user_password_change(op)
182
+ name = op.cmd_parse
183
+
184
+ password = nil
185
+
186
+ 3.times do
187
+ begin
188
+ system "stty -echo" # TODO termios
189
+ print "Password (typing will be hidden): "
190
+ password = STDIN.gets || ""
191
+ password = password[0..-2] # strip \n
192
+ rescue Interrupt
193
+ $stderr.print "\ncanceled."
194
+ exit 1
195
+ ensure
196
+ system "stty echo" # TODO termios
197
+ print "\n"
198
+ end
199
+
200
+ if password.empty?
201
+ $stderr.puts "canceled."
202
+ exit 0
203
+ end
204
+
205
+ begin
206
+ system "stty -echo" # TODO termios
207
+ print "Retype password: "
208
+ password2 = STDIN.gets || ""
209
+ password2 = password2[0..-2] # strip \n
210
+ rescue Interrupt
211
+ $stderr.print "\ncanceled."
212
+ exit 1
213
+ ensure
214
+ system "stty echo" # TODO termios
215
+ print "\n"
216
+ end
217
+
218
+ if password == password2
219
+ break
220
+ end
221
+
222
+ puts "Doesn't match."
223
+ end
224
+
225
+ client = get_client(:ssl => true)
226
+
227
+ client.change_password(name, password)
228
+
229
+ $stderr.puts "Password of user '#{name}' changed."
230
+ end
184
231
 
185
232
  end
186
233
  end
data/lib/td/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module TreasureData
2
2
 
3
- VERSION = '0.10.41'
3
+ VERSION = '0.10.42'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.41
4
+ version: 0.10.42
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-30 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: msgpack