Class: OctocatalogDiff::CatalogUtil::Command
- Inherits:
-
Object
- Object
- OctocatalogDiff::CatalogUtil::Command
- Defined in:
- lib/octocatalog-diff/catalog-util/command.rb
Overview
Used to construct the command to run ‘puppet’ to construct the catalog.
Instance Method Summary collapse
-
#initialize(options = {}, logger = nil) ⇒ Command
constructor
Constructor.
-
#puppet_argv ⇒ Object
Retrieve puppet_command, puppet_binary, puppet_argv.
- #puppet_binary ⇒ Object
- #puppet_command ⇒ Object
Constructor Details
#initialize(options = {}, logger = nil) ⇒ Command
Constructor
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/octocatalog-diff/catalog-util/command.rb', line 12 def initialize( = {}, logger = nil) @options = @logger = logger # Required parameters @compilation_dir = [:compilation_dir] raise ArgumentError, 'Compile dir (:compilation_dir) must be a string' unless @compilation_dir.is_a?(String) raise Errno::ENOENT, "Compile dir #{@compilation_dir} doesn't exist" unless File.exist?(@compilation_dir) raise ArgumentError, "Compile dir #{@compilation_dir} not a directory" unless File.directory?(@compilation_dir) @node = [:node] raise ArgumentError, 'Node must be specified to compile catalog' if @node.nil? || !@node.is_a?(String) # To be initialized on-demand @puppet_argv = nil @puppet_binary = nil end |
Instance Method Details
#puppet_argv ⇒ Object
Retrieve puppet_command, puppet_binary, puppet_argv
31 32 33 34 |
# File 'lib/octocatalog-diff/catalog-util/command.rb', line 31 def puppet_argv setup @puppet_argv end |
#puppet_binary ⇒ Object
36 37 38 39 |
# File 'lib/octocatalog-diff/catalog-util/command.rb', line 36 def puppet_binary setup @puppet_binary end |
#puppet_command ⇒ Object
41 42 43 44 |
# File 'lib/octocatalog-diff/catalog-util/command.rb', line 41 def puppet_command setup [@puppet_binary, @puppet_argv].flatten.join(' ') end |