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:



116
117
118
# File 'lib/rundeck/client/execution.rb', line 116

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:



146
147
148
149
150
151
152
153
154
# File 'lib/rundeck/client/execution.rb', line 146

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:



100
101
102
# File 'lib/rundeck/client/execution.rb', line 100

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:



87
88
89
# File 'lib/rundeck/client/execution.rb', line 87

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
# File 'lib/rundeck/client/execution.rb', line 21

def execute_job(id, options = {})
  objectify post("/job/#{id}/executions", options)['result']['executions']['execution']
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:



132
133
134
# File 'lib/rundeck/client/execution.rb', line 132

def execution(id, options = {})
  objectify get("/execution/#{id}", options)['result']['executions']['execution']
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:



165
166
167
# File 'lib/rundeck/client/execution.rb', line 165

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:



41
42
43
44
# File 'lib/rundeck/client/execution.rb', line 41

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