diff --git a/lib/vmdb/plugins.rb b/lib/vmdb/plugins.rb index 2a4be2caab0..9f32af4ead4 100644 --- a/lib/vmdb/plugins.rb +++ b/lib/vmdb/plugins.rb @@ -7,6 +7,7 @@ class Plugins def initialize @registered_automate_domains = [] @registered_provider_plugin_map = {} + @registered_ansible_content = [] @vmdb_plugins = [] end @@ -27,6 +28,7 @@ def register_vmdb_plugin(engine) @vmdb_plugins << engine register_automate_domains(engine) + register_ansible_content(engine) register_provider_plugin(engine) # make sure STI models are recognized @@ -54,10 +56,22 @@ def register_provider_plugin(engine) end end + def registered_content_directories(engine, subfolder) + Dir.glob(engine.root.join("content", subfolder, "*")).each do |content_directory| + yield content_directory + end + end + def register_automate_domains(engine) - Dir.glob(engine.root.join("content", "automate", "*")).each do |domain_directory| + registered_content_directories(engine, "automate") do |domain_directory| @registered_automate_domains << AutomateDomain.new(domain_directory) end end + + def register_ansible_content(engine) + registered_content_directories(engine, "ansible") do |content_directory| + @registered_ansible_content << AnsibleContent.new(content_directory) + end + end end end diff --git a/lib/vmdb/plugins/ansible_content.rb b/lib/vmdb/plugins/ansible_content.rb new file mode 100644 index 00000000000..3ff86a272e1 --- /dev/null +++ b/lib/vmdb/plugins/ansible_content.rb @@ -0,0 +1,15 @@ +module Vmdb + class Plugins + class AnsibleContent + attr_reader :datastores_path + attr_reader :name + attr_reader :path + + def initialize(path) + raise "#{path} does not exist" unless File.directory?(path) + @roles_path = Pathname.new(path) + @path = @roles_path.split.first + end + end + end +end