lib/kitchen/driver/centurylink.rb in kitchen-centurylink-0.1.2 vs lib/kitchen/driver/centurylink.rb in kitchen-centurylink-0.1.4
- old
+ new
@@ -15,11 +15,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'kitchen'
-require 'clc_client.rb'
+require 'clc_client'
require 'highline/import'
module Kitchen
module Driver
@@ -74,18 +74,16 @@
assign_public_ip(state)
else
state[:hostname] = serverInfo['details']['ipAddresses'][0]['internal']
end
-
-
end
def destroy(state)
info "Sending delete request for server #{state[:server_id]}"
- @@client.setToken(config[:token])
+ @@client.setToken(config[:token] || state[:token])
response = @@client.deleteServer(config[:alias], state[:server_id])
if response['isQueued'] == true
info 'Delete request is queued up'
state.delete(:server_id)
state.delete(:hostname)
@@ -105,16 +103,14 @@
:password => config[:password],
})
debug response
serverId = response['links'].select {|x| x['rel']=="self"}[0]['id']
+ puts "Server request accepted, with request id #{serverId}"
+ serverId
end
- def get_token(state)
- puts "Hi"
-
- end
def assign_public_ip(state)
response = @@client.addPublicIpAddress(config[:alias], state[:server_id], {
:ports => [ {:protocol => 'TCP', :port => 80},
{:protocol => 'TCP', :port => 8080},
{:protocol => 'TCP', :port => 443},