Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/OpenCloud/Compute/Resource/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,13 @@ protected function createJson()
. " keypair's name"
));
}
if (empty($this->keypair['publicKey'])) {
if (empty($this->keypair['public_key'])) {
throw new Exceptions\InvalidParameterError(sprintf(
'If you want to specify a keypair, you need to specify the'
. " keypair's publicKey value."
. " keypair's public_key value."
));
}
$server->keypair = (object) array(
'name' => $this->keypair['name'],
'public_key' => $this->keypair['publicKey']
);
$server->key_name = $this->keypair['name'];
}

return (object) array('server' => $server);
Expand Down
4 changes: 2 additions & 2 deletions tests/OpenCloud/Tests/Compute/Resource/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function test_Create_With_KeyPair()
$this->service->server()->create(array(
'keypair' => array(
'name' => 'foo',
'publicKey' => 'bar'
'public_key' => 'bar'
)
));
}
Expand Down Expand Up @@ -329,4 +329,4 @@ public function test_Create_Fails_Without_Correct_Networks()
));
}

}
}