lib/octofacts_updater/cli.rb
# Constructor.
#
# argv - The Array with command line arguments.
Constructor.
argv - The Array with command line arguments.
Constructor . argv - The Array with command line arguments .
def nodes_for_bulk
      if opts[:action] == "reindex"
        @opts[:quick] = true
        path = if opts[:path]
          File.expand_path(opts[:path])
        elsif @config.fetch("index", {})["node_path"]
          File.expand_path(@config.fetch("index", {})["node_path"], File.dirname(opts[:config]))
        else
          raise ArgumentError, "Must set --path, or define index:node_path to a valid directory in configuration"
        end
        unless File.directory?(path)
          raise Errno::ENOENT, "--path must be a directory (#{path.inspect} is not)"
        end
        Dir.glob("#{path}/*.yaml").map { |f| File.basename(f, ".yaml") }
      elsif opts[:host_list]
        opts[:host_list]
      elsif opts[:hostname]
        [opts[:hostname]]
      else
        OctofactsUpdater::FactIndex.load_file(index_file).nodes(true)
      end
    end
def nodes_for_bulk if opts [ :action ] == "reindex" @opts [ :quick ] = true path = if opts [ :path ] File . expand_path ( opts [ :path ] ) elsif @config . fetch ( "index" , { } ) [ "node_path" ] File . expand_path ( @config . fetch ( "index" , { } ) [ "node_path" ] , File . dirname ( opts [ :config ] ) ) else raise ArgumentError , "Must set --path, or define index:node_path to a valid directory in configuration" end unless File . directory? ( path ) raise Errno :: ENOENT , "--path must be a directory (#{path.inspect} is not)" end Dir . glob ( "#{path}/*.yaml" ) . map { | f | File . basename ( f , ".yaml" ) } elsif opts [ :host_list ] opts [ :host_list ] elsif opts [ :hostname ] [ opts [ :hostname ] ] else OctofactsUpdater :: FactIndex . load_file ( index_file ) . nodes ( true ) end end
Constructor.
Constructor .