class Conjur::CLI
Public Class Methods
appliance_version()
click to toggle source
# File lib/conjur/cli.rb, line 99 def appliance_version Conjur::API.service_version 'appliance' rescue nil end
apply_config()
click to toggle source
# File lib/conjur/cli.rb, line 58 def apply_config Conjur::Config.apply end
command_version_compatible?(command)
click to toggle source
# File lib/conjur/cli.rb, line 105 def command_version_compatible? command !command.instance_variable_defined?(:@conjur_min_version) || (appliance_version && command.instance_variable_get(:@conjur_min_version) <= appliance_version ) end
init!()
click to toggle source
This makes our generate-commands script a little bit cleaner. We can call this from that script to ensure that commands for all plugins are loaded.
# File lib/conjur/cli.rb, line 88 def init! subcommand_option_handling :normal load_config apply_config load_plugins commands_from 'conjur/command' rescue => ex stderr.puts "error: #{ex.message}" raise if ENV['GLI_DEBUG'] == 'true' end
load_config()
click to toggle source
# File lib/conjur/cli.rb, line 54 def load_config Conjur::Config.load end
load_plugins()
click to toggle source
# File lib/conjur/cli.rb, line 71 def load_plugins # These used to be plugins but now they are in the core CLI plugins = Conjur::Config.plugins - %w(audit-send host-factory layer pubkeys) plugins.each do |plugin| begin filename = "conjur-asset-#{plugin}" require filename rescue LoadError => err warn "WARNING: #{err.message}\n" \ "Could not load plugin '#{plugin}' specified in your config file.\n"\ "Make sure you have the #{filename} gem installed." end end end
run(args)
click to toggle source
Horible hack! We want to support legacy commands like host:list, but we don’t want to do too much effort, and GLIs support for aliasing doesn’t work out so well with subcommands.
Calls superclass method
# File lib/conjur/cli.rb, line 66 def run args args = args.shift.split(':') + args unless args.empty? super args end