Class: Fog::Networking::OracleCloud::Compute

Inherits:
Provider
  • Object
show all
Defined in:
lib/fog/networking/oraclecloud/compute.rb

Instance Method Summary collapse

Methods inherited from Provider

#initialize

Constructor Details

This class inherits a constructor from Fog::Networking::Provider

Instance Method Details

#connect(ip, port) ⇒ Object



27
28
29
30
# File 'lib/fog/networking/oraclecloud/compute.rb', line 27

def connect(ip, port)
	Fog::Logger.debug "Connecting #{ip} through port #{port} for #{@instance.name}"
	@secList.add_rule(port, ip);
end

#prepareObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/networking/oraclecloud/compute.rb', line 7

def prepare
	@secList = nil
	# Check if it has a non-default security list
	secLists = @instance.get_security_lists
	secLists.each do |i| 
		if !i.name.include? '/default/default' then @secList = i end
	end
	if !@secList then
		Fog::Logger.debug "Only has default security list. Add one now"
		@secList = @instance.create_security_list
	end

	# Check if it has a public ip
	if !@instance.get_public_ip_address then
		Fog::Logger.debug "Instance doesn't have a public ip address. Add one now"
		@instance.add_public_ip_address
	end	

end