mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|compute] Set password attribute on V2 servers.
Provides a method for determining next-gen server passwords. Adds a read-only attribute to next-gen servers for storing the root password. The attribute is set whenever a new server is created or the password on an existing server is changed.
This commit is contained in:
parent
9dbe1df8f2
commit
4d82f7bbc4
2 changed files with 10 additions and 0 deletions
|
@ -41,6 +41,8 @@ module Fog
|
|||
attribute :flavor_id, :aliases => 'flavor', :squash => 'id'
|
||||
attribute :image_id, :aliases => 'image', :squash => 'id'
|
||||
|
||||
attr_reader :password
|
||||
|
||||
def save
|
||||
if identity
|
||||
update
|
||||
|
@ -121,8 +123,15 @@ module Fog
|
|||
requires :identity
|
||||
connection.change_server_password(identity, password)
|
||||
self.state = PASSWORD
|
||||
@password = password
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def adminPass=(new_admin_pass)
|
||||
@password = new_admin_pass
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,6 +54,7 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server', ['rackspace']) do
|
|||
tests('#change_admin_password').succeeds do
|
||||
@instance.change_admin_password('somerandompassword')
|
||||
returns('PASSWORD') { @instance.state }
|
||||
returns('somerandompassword') { @instance.password }
|
||||
end
|
||||
|
||||
@instance.wait_for { ready? }
|
||||
|
|
Loading…
Reference in a new issue