lib/puppet/provider/compellent_cluster_server/compellent_cluster_server.rb
# Checks if there are any associated mappings for given server cluster
#
# @param cluster_server_index [String] index of server cluster object in compellent servers
# @return [Boolean]
Checks if there are any associated mappings for given server cluster
Checks if there are any associated mappings for given server cluster
def server_cluster_mappings_empty?(cluster_server_index)
    Puppet.debug("Getting Server Cluster Mappings for Index: %s" % cluster_server_index)
    libpath = CommonLib.get_path(1)
    exit_code_xml = "#{CommonLib.get_log_path(1)}/serverShowShowExitCode_#{CommonLib.get_unique_refid}.xml"
    show_response_xml = "#{CommonLib.get_log_path(1)}/serverShowShowResponse_#{CommonLib.get_unique_refid}.xml"
    connection.command_exec("#{libpath}","#{exit_code_xml}","\"#{show_server_commandline} -xml #{show_response_xml}\"")
    server_data = JSON.parse(JSON.pretty_generate(XmlSimple.xml_in(show_response_xml)))
    File.delete(exit_code_xml, show_response_xml)
    mapped_servers = server_data["server"].select do |server|
      folder_name = server["Folder"].first.is_a?(Hash) ? "" : server["Folder"].first
      server["ParentIndex"].first == cluster_server_index && folder_name.downcase == @resource[:folder].downcase
    end
    Puppet.debug("Found %d mapped servers for Server Cluster Index: %s" % [mapped_servers.length, cluster_server_index])
    mapped_servers.empty?
  end
def server_cluster_mappings_empty? ( cluster_server_index ) Puppet . debug ( "Getting Server Cluster Mappings for Index: %s" % cluster_server_index ) libpath = CommonLib . get_path ( 1 ) exit_code_xml = "#{CommonLib.get_log_path(1)}/serverShowShowExitCode_#{CommonLib.get_unique_refid}.xml" show_response_xml = "#{CommonLib.get_log_path(1)}/serverShowShowResponse_#{CommonLib.get_unique_refid}.xml" connection . command_exec ( "#{libpath}" , "#{exit_code_xml}" , "\"#{show_server_commandline} -xml #{show_response_xml}\"" ) server_data = JSON . parse ( JSON . pretty_generate ( XmlSimple . xml_in ( show_response_xml ) ) ) File . delete ( exit_code_xml , show_response_xml ) mapped_servers = server_data [ "server" ] . select do | server | folder_name = server [ "Folder" ] . first . is_a? ( Hash ) ? "" : server [ "Folder" ] . first server [ "ParentIndex" ] . first == cluster_server_index && folder_name . downcase == @resource [ :folder ] . downcase end Puppet . debug ( "Found %d mapped servers for Server Cluster Index: %s" % [ mapped_servers . length , cluster_server_index ] ) mapped_servers . empty? end
Checks if there are any associated mappings for given server cluster
Checks if there are any associated mappings for given server cluster
# Get all servers and see if any of them is mapped to our server cluster
None
Boolean
cluster_server_index
index of server cluster object in compellent servers
index of server cluster object in compellent servers