Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create the embedded ansible default project #19056

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions app/models/manageiq/providers/embedded_ansible/seeding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,7 @@ def seed
:resource => manager
)

create_local_playbook_repo
local_repo = ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource.find_or_create_by!(
:name => "#{Vmdb::Appliance.PRODUCT_NAME} Default Project",
:manager_id => manager.id
)
local_repo.raw_update_in_provider(
:scm_type => "git",
:scm_url => "file://#{local_playbook_repo_dir}",
:scm_update_on_launch => false
)
end

private

def create_local_playbook_repo
Ansible::Content.consolidate_plugin_playbooks

Dir.chdir(local_playbook_repo_dir) do
require 'rugged'
repo = Rugged::Repository.init_at(".")
index = repo.index
index.add_all("*")
index.write

options = {}
options[:tree] = index.write_tree(repo)
options[:author] = options[:committer] = { :email => "system@localhost", :name => "System", :time => Time.now.utc }
options[:message] = "Initial Commit"
options[:parents] = []
options[:update_ref] = 'HEAD'
Rugged::Commit.create(repo, options)
end
end

def local_playbook_repo_dir
Ansible::Content::PLUGIN_CONTENT_DIR
end
end
end
10 changes: 2 additions & 8 deletions spec/models/manageiq/providers/embedded_ansible_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@
expect(auth.manager_ref).to eq(auth.id.to_s)
end

it "creates the local playbook repo" do
repo = manager.configuration_script_sources.find_by(:name => "ManageIQ Default Project")

expect(repo.scm_type).to eq("git")
expect(repo.scm_url).to eq("file://#{consolidated_repo_path}")
expect(repo.scm_update_on_launch).to be_falsey

expect(Dir.exist?(File.join(consolidated_repo_path, ".git"))).to be_truthy
it "consolidates the embedded ansible content" do
expect(Dir.exist?(File.join(consolidated_repo_path))).to be_truthy
end
end
end