Permalink
Browse files

Have the DNS controller fix up the proposal at create time.

  • Loading branch information...
1 parent bc5fdf8 commit a724903703acbb57092e9893770b1b516c3e2a6a @VictorLowther VictorLowther committed Feb 12, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 crowbar_framework/app/controllers/dns_controller.rb
@@ -14,5 +14,19 @@
#
class DnsController < BarclampController
+
+ # Override proposal_create to inject default domain and support
+ # attributes if we are creating one with a default proposal.
+
+ def proposal_create
+ dns = (params[:attributes][:dns] || Hash.new)
+ if dns[:domain].nil? || (dns[:domain] == "pod.your.cloud.org")
+ dns[:domain]=%x{hostname -d}.strip
+ dns[:contact]="support@#{dns[:domain]}"
+ params[:attributes] ||= Hash.new
+ params[:attributes][:dns]=dns
+ end
+ super
+ end
end

0 comments on commit a724903

Please sign in to comment.