Class: Prof::EnvironmentManager
- Inherits:
-
Object
- Object
- Prof::EnvironmentManager
show all
- Defined in:
- lib/prof/environment_manager.rb
Defined Under Namespace
Classes: OpsManagerNotConfigured
Instance Method Summary
collapse
Constructor Details
Returns a new instance of EnvironmentManager.
15
16
17
|
# File 'lib/prof/environment_manager.rb', line 15
def initialize(pcf_environment)
@pcf_environment = pcf_environment
end
|
Instance Method Details
#destroy_orphan_deployments ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/prof/environment_manager.rb', line 37
def destroy_orphan_deployments
orphans = orphan_deployments
return unless orphans.any?
puts "Removing orphaned deployment(s) '#{orphans.join(', ')}'"
orphans.each do |deployment_name|
bosh_director.delete_deployment(deployment_name, force: true)
end
end
|
#destroy_orphan_tiles ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/prof/environment_manager.rb', line 29
def destroy_orphan_tiles
orphans = orphan_tiles
return unless orphans.any?
puts "Removing orphaned tile(s) #{orphans.map(&:name).join(', ')}"
ops_manager.uninstall_tiles(orphans)
end
|
#isolate_cloud_foundry(&_block) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/prof/environment_manager.rb', line 19
def isolate_cloud_foundry(&_block)
cloud_foundry.create_and_target_org(cf_org_name)
cloud_foundry.create_and_target_space(cf_space_name)
cloud_foundry.setup_permissive_security_group(cf_org_name, cf_space_name)
yield
cloud_foundry.delete_org(cf_org_name)
end
|
#reset ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/prof/environment_manager.rb', line 51
def reset
raise OpsManagerNotConfigured, "Please configure #{ops_manager.url}" unless ops_manager.cf_installed?
destroy_orphan_tiles
destroy_orphan_deployments
uninstall_tiles
end
|
#uninstall_tiles ⇒ Object
47
48
49
|
# File 'lib/prof/environment_manager.rb', line 47
def uninstall_tiles
ops_manager.uninstall_tiles(ops_manager.product_tiles)
end
|