1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-12 09:17:41 +03:00

F #4302: Fix NSX Security Groups errors (#4866)

Co-authored-by: mouyaq <amoya@opennebula.io>
This commit is contained in:
Angel Luis Moya Gonzalez 2020-06-02 16:51:18 +02:00 committed by GitHub
parent a190d2d14c
commit 4f144b2943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View File

@ -37,12 +37,8 @@ module NSXDriver
# its section_id. Returns its section_id if OpenNebula
# section already exists
def init_section
one_section = section_by_name(
NSXConstants::ONE_SECTION_NAME
)
one_section ||= create_section(
NSXConstants::ONE_SECTION_NAME
)
one_section = section_by_name(NSXConstants::ONE_SECTION_NAME)
one_section ||= create_section(NSXConstants::ONE_SECTION_NAME)
return one_section['id'] if one_section
end

View File

@ -38,12 +38,8 @@ module NSXDriver
# its section_id. Returns its section_id if OpenNebula
# section already exists
def init_section
one_section = section_by_name(
NSXConstants::ONE_SECTION_NAME
)
one_section ||= create_section(
NSXConstants::ONE_SECTION_NAME
)
one_section = section_by_name(NSXConstants::ONE_SECTION_NAME)
one_section ||= create_section(NSXConstants::ONE_SECTION_NAME)
return one_section.xpath('@id').text if one_section
end
@ -91,10 +87,12 @@ module NSXDriver
# - nil | [Nokogiri::XML::NodeSet] section
def section_by_name(section_name)
url = @url_sections + '?name=' + section_name
result = @nsx_client.get(url)
result = @nsx_client.get(url) rescue nil
return nil if result.nil?
xp = NSXConstants::NSXV_DFW_SECTION_XPATH
section = result.xpath(xp)
return section unless section.empty?
section
end
# Create new section