Class: Conjur::CLI
Defined Under Namespace
Classes: Complete
Class Method Summary collapse
- .appliance_version ⇒ Object
- .apply_config ⇒ Object
- .command_version_compatible?(command) ⇒ Boolean
-
.init! ⇒ Object
This makes our generate-commands script a little bit cleaner.
- .load_config ⇒ Object
- .load_plugins ⇒ Object
-
.run(args) ⇒ Object
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.
Class Method Details
.appliance_version ⇒ Object
97 98 99 100 101 |
# File 'lib/conjur/cli.rb', line 97 def appliance_version Conjur::API.service_version 'appliance' rescue nil end |
.apply_config ⇒ Object
59 60 61 |
# File 'lib/conjur/cli.rb', line 59 def apply_config Conjur::Config.apply end |
.command_version_compatible?(command) ⇒ Boolean
103 104 105 106 107 108 |
# File 'lib/conjur/cli.rb', line 103 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! ⇒ Object
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.
89 90 91 92 93 94 95 |
# File 'lib/conjur/cli.rb', line 89 def init! subcommand_option_handling :normal load_config apply_config load_plugins commands_from 'conjur/command' end |
.load_config ⇒ Object
55 56 57 |
# File 'lib/conjur/cli.rb', line 55 def load_config Conjur::Config.load end |
.load_plugins ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/conjur/cli.rb', line 72 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.}\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) ⇒ Object
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.
67 68 69 70 |
# File 'lib/conjur/cli.rb', line 67 def run args args = args.shift.split(':') + args unless args.empty? super args end |