5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/bosh/director/deployment_plan/deployment_repo.rb', line 5
def find_or_create_by_name(name, options={})
attributes = {name: name}
deployment = Bosh::Director::Models::Deployment.find(attributes)
if deployment and deployment.name != name
deployment = nil
end
return deployment if deployment
if options['scopes']
team_scopes = Bosh::Director::Models::Team.transform_admin_team_scope_to_teams(options['scopes'])
attributes.merge!(teams: team_scopes)
end
create_for_attributes(attributes)
end
|