Skip to content

Commit

Permalink
Merge pull request #1 from arnebrasseur/api_changed
Browse files Browse the repository at this point in the history
API no longer returns passwords.
  • Loading branch information
harlantwood committed Apr 28, 2012
2 parents ee1f336 + 59c3be7 commit 329b314
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ Run this from the command line to print the usage:
ps:usage <name> # list historical memory & CPU usage for <name>

users # list user accounts: details
users:pw # list user accounts: usernames & passwords

Listing of passwords is no longer supported by the Dreamhost API.

That's it for now. New commands should be springing up as Dreamy and the DreamHost API mature!

Expand Down
1 change: 0 additions & 1 deletion lib/dreamy/commands/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def usage
ps:usage <name> # list historical memory & CPU usage for <name>
users # list user accounts: details
users:pw # list user accounts: usernames & passwords
EOTXT
end
Expand Down
20 changes: 5 additions & 15 deletions lib/dreamy/commands/users.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module Dreamy::Command
class Users < Base

# Command:
# dh users
#
# Print table of users
def index
users = @account.users
if users.empty?
Expand All @@ -13,20 +17,6 @@ def index
display user_table
end
end

def pw
users = @account.users(passwords=true)
if users.empty?
display "No users on this account"
else
user_table = table do |t|
t.headings = 'UserName', 'Password'
users.each { |u| t << [u.username, u.password] }
end
display user_table

end
end

end
end
end
3 changes: 1 addition & 2 deletions lib/dreamy/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ def self.new_from_xml(xml)
u.disk_used_mb = (xml).at('disk_used_mb').innerHTML.to_f
u.gecos = (xml).at('gecos').innerHTML
u.home = (xml).at('home').innerHTML
u.password = (xml).at('password').innerHTML
u.quota_mb = (xml).at('quota_mb').innerHTML.to_i
u.shell = (xml).at('shell').innerHTML
u.type = (xml).at('type').innerHTML
u.username = (xml).at('username').innerHTML
u
end
end
end
end
4 changes: 1 addition & 3 deletions test/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class DreamyUserTest < Test::Unit::TestCase
<disk_used_mb>123.04</disk_used_mb>
<gecos>Joe Schmoe</gecos>
<home>spork.Dreamy.com</home>
<password>YahRight!</password>
<quota_mb>50</quota_mb>
<shell>/bin/bash</shell>
<type>mail</type>
Expand All @@ -25,12 +24,11 @@ class DreamyUserTest < Test::Unit::TestCase
assert_equal 123.04, u.disk_used_mb
assert_equal "Joe Schmoe", u.gecos
assert_equal "spork.Dreamy.com", u.home
assert_equal "YahRight!", u.password
assert_equal 50, u.quota_mb
assert_equal "/bin/bash", u.shell
assert_equal "mail", u.type
assert_equal "[email protected]", u.username
end
end

end
end

0 comments on commit 329b314

Please sign in to comment.