Class: PuppetX::Minio::Client
- Inherits:
-
Object
- Object
- PuppetX::Minio::Client
- Defined in:
- lib/puppet_x/minio/client.rb
Overview
rubocop:disable Style/Documentation
Constant Summary collapse
- CLIENT_LINK_LOCATION =
'/root/.minioclient'
Class Method Summary collapse
Class Method Details
.ensure_client_installed ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet_x/minio/client.rb', line 22 def self.ensure_client_installed return if @client_location unless installed? errormsg = [ "Symlink to minio client does not exist at #{CLIENT_LINK_LOCATION}. ", 'Make sure you installed the client before managing minio resources.', ] raise Puppet::ExecutionFailure, errormsg.join end @client_location = File.readlink(CLIENT_LINK_LOCATION) end |
.execute(args, **execute_args) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet_x/minio/client.rb', line 12 def self.execute(args, **execute_args) ensure_client_installed cmd = "#{@client_location} --json #{args}" out = Puppet::Util::Execution.execute(cmd, failonfail: true, **execute_args) out.each_line.map do |line| JSON.parse(line) end end |
.installed? ⇒ Boolean
36 37 38 |
# File 'lib/puppet_x/minio/client.rb', line 36 def self.installed? File.exist?(CLIENT_LINK_LOCATION) end |