-
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
[WIP] Add ServiceAnsiblePlaybook.check_connection #20645
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ class ServiceAnsiblePlaybook < ServiceGeneric | |
include AnsibleExtraVarsMixin | ||
include AnsiblePlaybookMixin | ||
|
||
delegate :playbook, :to => :service_template, :allow_nil => true | ||
delegate :playbook, :repository, :to => :service_template, :allow_nil => true | ||
|
||
# A chance for taking options from automate script to override options from a service dialog | ||
def preprocess(action, add_options = {}) | ||
|
@@ -18,6 +18,10 @@ def execute(action) | |
launch_ansible_job_queue(action) | ||
end | ||
|
||
def check_connection(action) | ||
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. The (by that, I mean they pass around a |
||
repository(action).check_connection | ||
end | ||
|
||
def launch_ansible_job_queue(action) | ||
task_opts = { | ||
:action => "Launching Ansible Job", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -258,6 +258,14 @@ def checkout | |
end | ||
end | ||
|
||
def check_connection(url) | ||
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. I know this is closed, but just as a note for me so I don't lose context, we were in the process of replacing this method with |
||
with_remote_options do |remote_options| | ||
@repo.remotes | ||
.create_anonymous(url) | ||
.check_connection(:fetch, remote_options) | ||
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.
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. Is check_connection here a rugged method? 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. |
||
end | ||
end | ||
|
||
def with_remote_options | ||
if @ssh_private_key | ||
@ssh_private_key_file = Tempfile.new | ||
|
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.
Doing this as a block to make sure the tmp dir is removed once we are done with the
.check_connection
call.The result of the block is what is returned, so the directory being deleted is just a side effect of that.