Class: JenkinsApi::CLI::Node
- Inherits:
-
Thor
- Object
- Thor
- JenkinsApi::CLI::Node
- Includes:
- Terminal, Thor::Actions
- Defined in:
- lib/jenkins_api_client/cli/node.rb
Overview
This class provides various command line operations for the Node class.
Instance Method Summary (collapse)
-
- (Object) list
CLI command that lists all nodes/slaves available in Jenkins or the ones matching the filter provided.
-
- (Object) print_general_attributes
CLI command that prints the general attribtues of nodes.
-
- (Object) print_node_attributes(node)
CLI command to print the attributes specific to a node.
-
- (Object) print_node_properties(node)
CLI command to print the properties of a specific node.
Instance Method Details
- (Object) list
CLI command that lists all nodes/slaves available in Jenkins or the ones matching the filter provided
39 40 41 42 43 44 45 46 |
# File 'lib/jenkins_api_client/cli/node.rb', line 39 def list @client = Helper.setup() if [:filter] puts @client.node.list([:filter]) else puts @client.node.list end end |
- (Object) print_general_attributes
CLI command that prints the general attribtues of nodes
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/jenkins_api_client/cli/node.rb', line 50 def print_general_attributes @client = Helper.setup() general_attributes = Client::Node::GENERAL_ATTRIBUTES rows = [] general_attributes.each do |attr| rows << [attr, @client.node.method("get_#{attr}").call] end table = Table.new :headings => ['Attribute', 'Value'], :rows => rows puts table end |
- (Object) print_node_attributes(node)
CLI command to print the attributes specific to a node
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/jenkins_api_client/cli/node.rb', line 66 def print_node_attributes(node) @client = Helper.setup() node_attributes = Client::Node::NODE_ATTRIBUTES rows = [] node_attributes.each do |attr| rows << [attr, @client.node.method("get_node_#{attr}").call(node)] end table = Table.new :headings => ['Attribute', 'Value'], :rows => rows puts "Node: #{node}" puts table end |
- (Object) print_node_properties(node)
CLI command to print the properties of a specific node
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/jenkins_api_client/cli/node.rb', line 83 def print_node_properties(node) @client = Helper.setup() node_properties = Client::Node::NODE_PROPERTIES rows = [] node_properties.each do |property| rows << [property, @client.node.method("is_#{property}?").call(node)] end table = Table.new :headings => ['Property', 'Value'], :rows => rows puts "Node: #{node}" puts table end |