Class: Bosh::Director::KeyGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/key_generator.rb

Instance Method Summary collapse

Instance Method Details

#dependency_key_from_manifest(package_name, compiled_packages) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/bosh/director/key_generator.rb', line 21

def dependency_key_from_manifest(package_name, compiled_packages)
  @all_packages = compiled_packages
  package = compiled_packages.find { |package| package['name'] == package_name }
  raise ReleaseExistingPackageHashMismatch, "Package '#{package_name}' not found in the release manifest." if package.nil?

  package['dependencies'].sort.map do |dependency_name|
    arrayify(find_package_hash(dependency_name), all_packages.dup)
  end.to_json
end

#dependency_key_from_models(package, release_version) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bosh/director/key_generator.rb', line 4

def dependency_key_from_models(package, release_version)
  @all_packages = release_version.packages.map do |p|
    {
      'name' => p.name,
      'version' => p.version,
      'dependencies' => p.dependency_set
    }
  end

  root_package_hash = {'name' => package.name, 'version' => package.version, 'dependencies' => package.dependency_set}
  package_hashes = PackageDependenciesManager.new(release_version).transitive_dependencies(package)

  root_package_hash['dependencies'].sort.map do |dependency_name|
    arrayify(find_package_hash(dependency_name), package_hashes.dup)
  end.to_json
end