From e7a04d5487f080215ba80eaffc3464fb5225264a Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Wed, 16 Jul 2014 11:00:12 +0200 Subject: [PATCH] Feature #2917: Code legibility --- src/onegate/onegate-server.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/onegate/onegate-server.rb b/src/onegate/onegate-server.rb index 4c7bdef6b9..fc5b376a95 100644 --- a/src/onegate/onegate-server.rb +++ b/src/onegate/onegate-server.rb @@ -138,9 +138,7 @@ end NIC_VALID_KEYS = %w(IP IP6_LINK IP6_SITE IP6_GLOBAL NETWORK MAC) -USER_TEMPLATE_INVALID_KEYS = %w( - SCHED_MESSAGE -) +USER_TEMPLATE_INVALID_KEYS = %w(SCHED_MESSAGE ) def build_vm_hash(vm_hash) nics = [] @@ -276,11 +274,11 @@ get '/service' do halt 400, error_msg end + # Check that the user has not spoofed the Service_ID service_vm_ids = response["SERVICE"]["roles"].collect do |r| r["nodes"].collect{|n| n["deploy_id"]} - end.flatten + end.flatten rescue [] - # Check that the user has not spoofed the Service_ID if service_vm_ids.empty? || !service_vm_ids.include?(vm_id) error_msg = "VMID:#{vm_id} Service #{service_id} does not contain VM." logger.error {error_msg}