Chapter 09/circuit-oneops-1-master/components/cookbooks/azure_base/libraries/availability_set_manager.rb
# this method will add the availability set if needed.
# it first checks to make sure the availability set exists,
# if not, it will create it.
this method will add the availability set if needed.
it first checks to make sure the availability set exists,
if not, it will create it.
this method will add the availability set if needed . it first checks to make sure the availability set exists if not it will create it .
def add
      as = get
      if !as.nil?
        OOLog.info("Availability Set #{as.name} exists in the #{as.location} region.")
      else
        OOLog.info("Creating Availability Set
                      '#{@as_name}' in #{@location} region")
        avail_set = get_avail_set_props
        begin
          response =
            @client.availability_sets.create_or_update(@rg_name,
                                                       @as_name,
                                                       avail_set).value!
          return response
        rescue MsRestAzure::AzureOperationError => e
          OOLog.fatal("Error adding an availability set: #{e.body}")
        rescue => ex
          OOLog.fatal("Error adding an availability set: #{ex.message}")
        end
      end
    end
def add as = get if ! as . nil? OOLog . info ( "Availability Set #{as.name} exists in the #{as.location} region." ) else OOLog . info ( "Creating Availability Set
                      '#{@as_name}' in #{@location} region" ) avail_set = get_avail_set_props begin response = @client . availability_sets . create_or_update ( @rg_name , @as_name , avail_set ) . value! return response rescue MsRestAzure :: AzureOperationError => e OOLog . fatal ( "Error adding an availability set: #{e.body}" ) rescue => ex OOLog . fatal ( "Error adding an availability set: #{ex.message}" ) end end end
this method will add the availability set if needed.
this method will add the availability set if needed .
# check if it exists # need to create the availability set