Chapter 09/circuit-oneops-1-master/components/cookbooks/spark-v1/recipes/spark_helper.rb
# Looks up the Nexus URL and ensures that it is in the proper format
#
# RETURNS:
# A string containing the URL, or "" if it could not be found
#
Looks up the Nexus URL and ensures that it is in the proper format
RETURNS:
A string containing the URL, or "" if it could not be found
Looks up the Nexus URL and ensures that it is in the proper format RETURNS : A string containing the URL or " " if it could not be found
def find_nexus_url()
  nexus_url = ""
  cloud_vars = node.workorder.payLoad.OO_CLOUD_VARS
  cloud_vars.each do |var|
    if var[:ciName] == "nexus"
      nexus_url = "#{var[:ciAttributes][:value]}"
    end
  end
  if nexus_url == ""
    cloud_name = node[:workorder][:cloud][:ciName]
    if (!node[:workorder][:services]["maven"].nil?)
      nexus_url = node[:workorder][:services]['maven'][cloud_name][:ciAttributes][:url]
    end
  end
  if nexus_url != ""
    nexus_url = fix_nexus_url(nexus_url)
  end
  return nexus_url
end
def find_nexus_url ( ) nexus_url = "" cloud_vars = node . workorder . payLoad . OO_CLOUD_VARS cloud_vars . each do | var | if var [ :ciName ] == "nexus" nexus_url = "#{var[:ciAttributes][:value]}" end end if nexus_url == "" cloud_name = node [ :workorder ] [ :cloud ] [ :ciName ] if ( ! node [ :workorder ] [ :services ] [ "maven" ] . nil? ) nexus_url = node [ :workorder ] [ :services ] [ 'maven' ] [ cloud_name ] [ :ciAttributes ] [ :url ] end end if nexus_url != "" nexus_url = fix_nexus_url ( nexus_url ) end return nexus_url end
Looks up the Nexus URL and ensures that it is in the proper format
RETURNS:
A string containing the URL, or "" if it could not be found
Looks up the Nexus URL and ensures that it is in the proper format RETURNS : A string containing the URL or " " if it could not be found
# Find the Nexus URL # Look in the cloud variables first to see if a value is specified # The variables did not have a value...look in the services. # Look in the defined services # Fix it up if one was found