93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/nex_client/commands/addons.rb', line 93
def self.create(args,opts)
svc_name,app_name = args
app = NexClient::App.find(name: app_name).first
unless app
error("Error! Could not find app: #{app_name}")
return false
end
attrs = {}
attrs[:service] = svc_name
attrs[:container_size] = opts.size if opts.size.present?
attrs[:opts] = self.(opts)
addon = NexClient::Addon.new(attrs)
addon.relationships.attributes = { app: { data: { type: 'apps', id: app.id } } }
addon.save
if addon.errors.any?
display_record_errors(addon)
return false
end
self.display_addons(NexClient::Addon.includes(:app).find(addon.id).first)
end
|