]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/keystone/lib/puppet/type/keystone_tenant.rb
Update to Kilo
[dsa-puppet.git] / 3rdparty / modules / keystone / lib / puppet / type / keystone_tenant.rb
index f8aac517d7713ca7c6b3e17850bda8f4141eaa57..449ccd04e36043374bbb21414f1d661e85fd59ae 100644 (file)
@@ -1,6 +1,8 @@
 # LP#1408531
 File.expand_path('../..', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) }
-require 'puppet/util/openstack'
+File.expand_path('../../../../openstacklib/lib', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) }
+require 'puppet/provider/keystone/util'
+
 Puppet::Type.newtype(:keystone_tenant) do
 
   desc 'This type can be used to manage keystone tenants.'
@@ -12,10 +14,6 @@ Puppet::Type.newtype(:keystone_tenant) do
     newvalues(/\w+/)
   end
 
-  newparam(:os_cacert) do
-    desc 'Parse os_cacert.'
-  end
-
   newproperty(:enabled) do
     desc 'Whether the tenant should be enabled. Defaults to true.'
     newvalues(/(t|T)rue/, /(f|F)alse/, true, false )
@@ -37,6 +35,20 @@ Puppet::Type.newtype(:keystone_tenant) do
     end
   end
 
+  newproperty(:domain) do
+    desc 'Domain for tenant.'
+    newvalues(nil, /\S+/)
+    def insync?(is)
+      raise(Puppet::Error, "The domain cannot be changed from #{self.should} to #{is}") unless self.should == is
+      true
+    end
+  end
+
+  autorequire(:keystone_domain) do
+    # use the domain parameter if given, or the one from name if any
+    self[:domain] || Util.split_domain(self[:name])[1]
+  end
+
   # This ensures the service is started and therefore the keystone
   # config is configured IF we need them for authentication.
   # If there is no keystone config, authentication credentials
@@ -44,10 +56,4 @@ Puppet::Type.newtype(:keystone_tenant) do
   autorequire(:service) do
     ['keystone']
   end
-
-  auth_param_doc=<<EOT
-If no other credentials are present, the provider will search in
-/etc/keystone/keystone.conf for an admin token and auth url.
-EOT
-  Puppet::Util::Openstack.add_openstack_type_methods(self, auth_param_doc)
 end