-
Notifications
You must be signed in to change notification settings - Fork 897
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
Avoid seeding ansible content in production #21089
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,28 @@ def initialize(path) | |
def fetch_galaxy_roles | ||
return true unless requirements_file.exist? | ||
|
||
params = ["install", :roles_path= => roles_dir, :role_file= => requirements_file] | ||
AwesomeSpawn.run!("ansible-galaxy", :params => params) | ||
require "awesome_spawn" | ||
AwesomeSpawn.run!("ansible-galaxy", :params => ["install", :roles_path= => roles_dir, :role_file= => requirements_file]) | ||
end | ||
|
||
def self.consolidate_plugin_playbooks(dir = PLUGIN_CONTENT_DIR) | ||
def self.fetch_plugin_galaxy_roles | ||
require "vmdb/plugins" | ||
|
||
Vmdb::Plugins.ansible_runner_content.each do |plugin, content_dir| | ||
puts "Fetching ansible galaxy roles for #{plugin.name}..." | ||
begin | ||
new(content_dir).fetch_galaxy_roles | ||
puts "Fetching ansible galaxy roles for #{plugin.name}...Complete" | ||
rescue AwesomeSpawn::CommandResultError => err | ||
puts "Fetching ansible galaxy roles for #{plugin.name}...Failed - #{err.result.error}" | ||
raise | ||
end | ||
end | ||
end | ||
|
||
def self.consolidate_plugin_content(dir = PLUGIN_CONTENT_DIR) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note the method rename here. This was intentional, as we don't just consolidate playbooks, so the name was inaccurate and confusing. |
||
require "vmdb/plugins" | ||
|
||
FileUtils.rm_rf(dir) | ||
FileUtils.mkdir_p(dir) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
namespace :evm do | ||
namespace :ansible_runner do | ||
desc "Seed galaxy roles for provider playbooks" | ||
desc "Seed plugin ansible content and galaxy roles" | ||
task :seed do | ||
require 'awesome_spawn' | ||
require "vmdb/plugins" | ||
require 'ansible/content' | ||
require "ansible/content" | ||
|
||
Vmdb::Plugins.ansible_runner_content.each do |plugin, content_dir| | ||
content = Ansible::Content.new(content_dir) | ||
puts "Fetching ansible galaxy roles for plugins..." | ||
Ansible::Content.fetch_plugin_galaxy_roles | ||
puts "Fetching ansible galaxy roles for plugins...Complete" | ||
|
||
puts "Seeding roles for #{plugin.name}..." | ||
begin | ||
content.fetch_galaxy_roles | ||
puts "Seeding roles for #{plugin.name}...Complete" | ||
rescue AwesomeSpawn::CommandResultError => err | ||
puts "Seeding roles for #{plugin.name}...Failed - #{err.result.error}" | ||
raise | ||
end | ||
end | ||
puts "Consolidating plugin ansible content..." | ||
Ansible::Content.consolidate_plugin_content | ||
puts "Consolidating plugin ansible content...Complete" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still feel this would be better suited for /bin/update or /bin/setup
but I'm ok with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I didn't want to rock this boat too much, so I left it...we can definitely debate dropping it from here, but I'd rather do that in a follow up.
I really don't understand the use case of why it's here in seed in the first place. From what I can tell it's for developers modifying things, but then, I don't see why they can't just call evm:ansible_runner:seed themselves.