class Bosh::Workspace::Tasks::Deployment
Public Class Methods
new(deployment)
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 3 def initialize(deployment) schema.validate deployment @raw = OpenStruct.new(deployment) end
Public Instance Methods
apply_patch()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 41 def apply_patch @raw.apply_patch end
create_patch()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 45 def create_patch @raw.create_patch end
errands()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 37 def errands @raw.errands end
file_name()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 33 def file_name @raw.name + ".yml" end
merged_file()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 29 def merged_file File.join ".deployments", file_name end
name()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 8 def name file = File.join 'deployments', file_name YAML.load_file(file)["name"] end
password()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 23 def password return "admin" unless @raw.target =~ /@/ match = @raw.target.match(/^[^:@]+:([^@]+)/) match && match[1] || "admin" end
target()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 13 def target return @raw.target unless @raw.target =~ /@/ @raw.target.split('@')[1] end
username()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 18 def username return "admin" unless @raw.target =~ /@/ @raw.target.match(/^([^@:]+)/)[1] || "admin" end
Private Instance Methods
schema()
click to toggle source
# File lib/bosh/workspace/tasks/deployment.rb, line 51 def schema Membrane::SchemaParser.parse do { "name" => /^((?!\.yml).)*$/, # Should not contain .yml "target" => String, optional("apply_patch") => String, optional("create_patch") => String, optional("errands") => [String] } end end