Sha256: 62e8361946c5d6e4104780e6b49b85303751f41b4ee50fa253c0a3b06ef7fef8

Contents?: true

Size: 1.52 KB

Versions: 19

Compression:

Stored size: 1.52 KB

Contents

module Ridley
  class SandboxObject < ChefObject
    set_chef_id "sandbox_id"

    attribute :sandbox_id,
      type: String

    attribute :uri,
      type: String

    attribute :checksums,
      type: Hash

    attribute :is_completed,
      type: Buff::Boolean,
      default: false

    # Return information about the given checksum
    #
    # @example
    #   sandbox.checksum("e5a0f6b48d0712382295ff30bec1f9cc") => {
    #     needs_upload: true,
    #     url: "https://s3.amazonaws.com/opscode-platform-production-data/organization"
    #   }
    #
    # @param [#to_sym] chk_id
    #   checksum to retrieve information about
    #
    # @return [Hash]
    #   a hash containing the checksum information
    def checksum(chk_id)
      checksums[chk_id.to_sym]
    end

    # Concurrently upload all of this sandboxes files into the checksum containers of the sandbox
    #
    # @param [Hash] checksums
    #   a hash of file checksums and file paths
    #
    # @example
    #   sandbox.upload(
    #     "e5a0f6b48d0712382295ff30bec1f9cc" => "/Users/reset/code/rbenv-cookbook/recipes/default.rb",
    #     "de6532a7fbe717d52020dc9f3ae47dbe" => "/Users/reset/code/rbenv-cookbook/recipes/ohai_plugin.rb"
    #   )
    def upload(checksums)
      resource.upload(self, checksums)
    end

    # Notify the Chef Server that uploading to this sandbox has completed
    #
    # @raise [Ridley::Errors::SandboxCommitError]
    def commit
      response = resource.commit(self)
      set_attribute(:is_completed, response[:is_completed])
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ridley-5.1.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-5.1.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-5.0.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.6.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.6.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.5.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.5.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.4.3 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.4.2 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.4.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.4.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.3.2 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.3.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.3.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.2.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.1.2 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.1.1 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.1.0 lib/ridley/chef_objects/sandbox_object.rb
ridley-4.0.0 lib/ridley/chef_objects/sandbox_object.rb