Skip to content

Commit

Permalink
Added Embedded Ansible Content plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
syncrou committed Mar 6, 2018
1 parent 7a68d86 commit 360a4f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/vmdb/plugins.rb
Expand Up @@ -7,6 +7,7 @@ class Plugins
def initialize
@registered_automate_domains = []
@registered_provider_plugin_map = {}
@registered_embedded_ansible_content = []
@vmdb_plugins = []
end

Expand All @@ -27,6 +28,7 @@ def register_vmdb_plugin(engine)
@vmdb_plugins << engine

register_automate_domains(engine)
register_embedded_ansible_content(engine)
register_provider_plugin(engine)

# make sure STI models are recognized
Expand Down Expand Up @@ -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_embedded_ansible_content(engine)
registered_content_directories(engine, "ansible") do |content_directory|
@registered_embedded_ansible_content << EmbeddedAnsibleContent.new(content_directory)
end
end
end
end
15 changes: 15 additions & 0 deletions lib/vmdb/plugins/embedded_ansible_content.rb
@@ -0,0 +1,15 @@
module Vmdb
class Plugins
class EmbeddedAnsibleContent
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

0 comments on commit 360a4f4

Please sign in to comment.