def wait_for_instance_ready
      # On a rebundle, the cert file may exist but be from a previous launch. No way of fixing this, as the
      # modified time of the cert_file will be older than the booted time on start/stop (its not refreshed)
      # and newer than the booted time on a normal boot. Customers have to know to clean /var/lib/waagent.
      #
      # If we want to support wrap on linux we need an alternate check, such as checking
      # some sort of status on waagent and a time
      if platform.linux?
        STDOUT.puts "Waiting for instance to appear ready."
        until File.exists?(fetcher.user_metadata_cert_store)
          sleep(1)
        end
        STDOUT.puts "Instance appears ready."
      end
    end
def wait_for_instance_ready
      # On a rebundle, the cert file may exist but be from a previous launch. No way of fixing this, as the
      # modified time of the cert_file will be older than the booted time on start/stop (its not refreshed)
      # and newer than the booted time on a normal boot. Customers have to know to clean /var/lib/waagent.
      #
      # If we want to support wrap on linux we need an alternate check, such as checking
      # some sort of status on waagent and a time
      if platform.linux?
        STDOUT.puts "Waiting for instance to appear ready."
        until File.exists?(fetcher.user_metadata_cert_store)
          sleep(1)
        end
        STDOUT.puts "Instance appears ready."
      end
    end
def parse_metadata(tree_climber, data)
   result = tree_climber.create_branch
   data.each do |k, v|
     # Make sure we coerce into strings. The json blob returned here auto-casts
     # types which will mess up later steps
     result[k.to_s.strip] = v.to_s.strip
   end
   result
 end