Module: Rundeck::Client::Execution

Included in:
Rundeck::Client
Defined in:
lib/rundeck/client/execution.rb

Overview

Defines methods related to executions.

Instance Method Summary collapse

Instance Method Details

#abort_execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash

Note:

This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.

  • query: { param1: ‘value’, param2: ‘value’ }

Abort a running execution

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



113
114
115
# File 'lib/rundeck/client/execution.rb', line 113

def abort_execution(id, options = {})
  objectify post("/execution/#{id}/abort", options)['abort']
end

#bulk_delete_executions(ids, options = {}) ⇒ Rundeck::ObjectifiedHash

Bulk delete executions

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



149
150
151
152
153
154
155
156
157
# File 'lib/rundeck/client/execution.rb', line 149

def bulk_delete_executions(ids, options = {})
  unless ids.is_a?(Array)
    fail Rundeck::Error::InvalidAttributes, '`ids` must be an array of ids'
  end

  options[:query] = {} if options[:query].nil?
  options[:query].merge!(ids: ids.join(','))
  objectify post('/executions/delete', options)['deleteExecutions']
end

#delete_execution(id, options = {}) ⇒ nil

Delete an execution

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

  • (nil)

    If the delete was successful

Raises:

See Also:



97
98
99
# File 'lib/rundeck/client/execution.rb', line 97

def delete_execution(id, options = {})
  delete("/execution/#{id}", options)
end

#delete_job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash

Delete all executions for a specific job

Examples:

Rundeck.delete_job_executions('c07518ef-b697-4792-9a59-5b4f08855b67')

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



84
85
86
# File 'lib/rundeck/client/execution.rb', line 84

def delete_job_executions(id, options = {})
  objectify delete("/job/#{id}/executions", options)['deleteExecutions']
end

#execute_job(id, options = {}) ⇒ Rundeck::ObjectifiedHash Also known as: run_job

Note:

This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.

  • query: { param1: ‘value’, param2: ‘value’ }

Execute a job

Examples:

Rundeck.execute_job('c07518ef-b697-4792-9a59-5b4f08855b67')
Rundeck.run_job('c07518ef-b697-4792-9a59-5b4f08855b67')

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



21
22
23
24
25
26
27
28
29
# File 'lib/rundeck/client/execution.rb', line 21

def execute_job(id, options = {})
  e = post("/job/#{id}/executions", options)
  # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25
  begin
    objectify e['result']['executions']
  rescue
    objectify e['executions']
  end
end

#execution(id, options = {}) ⇒ Rundeck::ObjectifiedHash

Get info for an execution

Examples:

Rundeck.execution('c07518ef-b697-4792-9a59-5b4f08855b67'')

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



129
130
131
132
133
134
135
136
137
# File 'lib/rundeck/client/execution.rb', line 129

def execution(id, options = {})
  e = get("/execution/#{id}", options)
  # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25
  begin
    objectify e['result']['executions']['execution']
  rescue
    objectify e['executions']['execution']
  end
end

#execution_query(project, options = {}) ⇒ Object

Note:

This method maps to an advanced Rundeck endpoint. View the Rundeck API documentation and understand what query parameters are required. Responses may include paging details. Recall this method with the next set of paging values to retrieve more elements.

Query for executions based on job or execution details.



181
182
183
184
185
186
187
188
189
190
# File 'lib/rundeck/client/execution.rb', line 181

def execution_query(project, options = {})
  options = project_options_query(project, options)
  q = get('/executions', options)
  # Temporary fix for https://github.com/dblessing/rundeck-ruby/issues/25
  begin
    objectify q['result']['executions']
  rescue
    objectify q['executions']
  end
end

#execution_state(id, options = {}) ⇒ Rundeck::ObjectifiedHash

Get the state of an execution

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



168
169
170
# File 'lib/rundeck/client/execution.rb', line 168

def execution_state(id, options = {})
  objectify get("/execution/#{id}/state", options)['result']['executionState']
end

#job_executions(id, options = {}) ⇒ Rundeck::ObjectifiedHash

Note:

This method has optional Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.

  • query: { param1: ‘value’, param2: ‘value’ }

Get executions for a specific job.

Examples:

Rundeck.job_executions('c07518ef-b697-4792-9a59-5b4f08855b67')

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



47
48
49
50
# File 'lib/rundeck/client/execution.rb', line 47

def job_executions(id, options = {})
  r = get("/job/#{id}/executions", options)['result']['executions']
  objectify r
end

#running_job_executions(project, options = {}) ⇒ Rundeck::ObjectifiedHash

Note:

This method has required Rundeck parameters that can be passed to the options parameter. See Rundeck API documentation for more information.

  • query: { param1: ‘value’, param2: ‘value’ }

Get all running job executions

Examples:

Rundeck.running_job_executions('anvils')

Parameters:

Options Hash (options):

  • :query (Hash)

    The parameters to pass with the request Use this hash to specify Rundeck parameters.

    • query: { project: ‘anvils’, id: ‘123456’ }

Returns:

Raises:

See Also:



66
67
68
69
# File 'lib/rundeck/client/execution.rb', line 66

def running_job_executions(project, options = {})
  options = project_options_query(project, options)
  objectify get('/executions/running', options)['result']['executions']
end