Skip to content

Commit

Permalink
Merge pull request #22759 from agrare/seed_workflows_from_content
Browse files Browse the repository at this point in the history
Seed workflows from plugins' content/workflows
  • Loading branch information
Fryguy authored Mar 29, 2024
2 parents 0456aff + f71e3ba commit 6330e2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def sync_and_notify
end

def git_repository
(super || (ensure_git_repository && super)).tap { |r| sync_git_repository(r) }
(super || (ensure_git_repository && super))&.tap { |r| sync_git_repository(r) }
end

def verify_ssl=(val)
Expand Down Expand Up @@ -86,13 +86,17 @@ def sync
end

def checkout_git_repository(target_directory)
return if git_repository.nil?

git_repository.update_repo
git_repository.checkout(scm_branch, target_directory)
end

private

def ensure_git_repository
return if scm_url.blank?

transaction do
repo = GitRepository.create!(attrs_for_sync_git_repository)
if new_record?
Expand All @@ -108,6 +112,8 @@ def sync_git_repository(git_repository = nil)
return unless name_changed? || scm_url_changed? || authentication_id_changed? || @verify_ssl_changed

git_repository ||= self.git_repository
return if git_repository.nil?

git_repository.attributes = attrs_for_sync_git_repository
end

Expand Down
6 changes: 6 additions & 0 deletions lib/vmdb/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def ansible_runner_content
end
end

def embedded_workflows_content
@embedded_workflows_content ||= index_with do |engine|
engine.root.join("content", "workflows").glob("**/*.asl")
end
end

def automate_domains
@automate_domains ||= begin
require_relative 'plugins/automate_domain'
Expand Down

0 comments on commit 6330e2c

Please sign in to comment.