Permalink
Browse files

fixed remove_vlan implementation

  • Loading branch information...
1 parent cd274df commit f531a780d918eb06c310b1d38155f963389047d3 @gato-omega committed Jan 24, 2012
Showing with 20 additions and 8 deletions.
  1. +15 −3 app/controllers/gateway_controller.rb
  2. +3 −3 app/controllers/practicas_controller.rb
  3. +2 −2 lib/irc/remote_irc_gateway.rb
@@ -28,10 +28,22 @@ def index
render :status => 200
when 'remove_vlan'
- #puerto_id, endpoint_id, practica_id= params[:puerto_id], params[:endpoint_id], params[:practica_id]
- the_vlan = Vlan.new(params[:vlan])
+ #puerto_id, endpoint_id, practica_id = params[:puerto_id], params[:endpoint_id], params[:practica_id]
+ #puerto = Puerto.find(puerto_id)
+ #endpoint = Puerto.find(endpoint_id)
+ #practica = Puerto.find(practica_id)
+ the_vlan = Vlan.find(params[:id])
+ #the_vlan.puerto = puerto
+ #the_vlan.endpoint = endpoint
+ #the_vlan.practica = practica
+
+ #the_vlan = Vlan.new(params[:vlan])
@irc_gateway.remove_vlan the_vlan
- render :status => 200
+ if the_vlan.destroy
+ render :status => 200
+ else
+ render :status => 500
+ end
when 'reset_practica'
the_practica = Practica.find(params[:id])
@@ -281,9 +281,9 @@ def new_conexion
def remove_conexion
the_vlan = Vlan.find(params[:con_id])
- if the_vlan.destroy
- channel = "practica_#{params[:id]}"
- RemoteIRCGateway.instance.remove_vlan the_vlan.puerto.id, the_vlan.endpoint.id, the_vlan.practica.id
+ channel = "practica_#{params[:id]}"
+
+ if (RemoteIRCGateway.instance.remove_vlan the_vlan).class.eql? Net::HTTPOK
mensaje_raw = FayeMessagesController.new.generate_remove_conexion_output the_vlan
send_via_faye "#{FAYE_CHANNEL_PREFIX}#{channel}", mensaje_raw
end
@@ -11,8 +11,8 @@ def create_vlan(vlan)
send_to_remote :create_vlan, :id => id
end
- def remove_vlan(puerto_id, endpoint_id, practica_id)
- send_to_remote :remove_vlan, :vlan => {:puerto_id => puerto_id,:endpoint_id => endpoint_id, :practica_id => practica_id}
+ def remove_vlan(vlan)
+ send_to_remote :remove_vlan, :id => vlan.id
end
def status

0 comments on commit f531a78

Please sign in to comment.