From 04c73a970d991be59d3f17a7883508ce00c8ba60 Mon Sep 17 00:00:00 2001 From: Nate Wolfe Date: Fri, 21 Aug 2020 14:38:04 -0700 Subject: [PATCH 1/3] (maint) Remove warning about missing configuration file Previously the CLI would emit a warning about missing configuration file, but a configuration file does not appear to be a requirement, at least based on the documentation and the fact that everything can be specified directly on the command line. This commit simply removes the warning. Users will no longer get a warning when doing things like `floaty --version`, `floaty help`, and any other subcommand. --- lib/vmfloaty/conf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vmfloaty/conf.rb b/lib/vmfloaty/conf.rb index 0b61f30..904020d 100644 --- a/lib/vmfloaty/conf.rb +++ b/lib/vmfloaty/conf.rb @@ -8,7 +8,7 @@ class Conf begin conf = YAML.load_file("#{Dir.home}/.vmfloaty.yml") rescue StandardError - FloatyLogger.warn "WARNING: There was no config file at #{Dir.home}/.vmfloaty.yml" + # ignore end conf end From 8341a5f45dbae17accf3ff8b3631637e566d4e62 Mon Sep 17 00:00:00 2001 From: Nate Wolfe Date: Fri, 21 Aug 2020 15:45:10 -0700 Subject: [PATCH 2/3] (maint) Mention configuration file in CLI help text description So users can be aware of the configuration file since it will no longer be emitted as a warning during CLI invocation. --- lib/vmfloaty.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 19e194a..7734778 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -20,7 +20,7 @@ class Vmfloaty def run # rubocop:disable Metrics/AbcSize program :version, Vmfloaty::VERSION - program :description, "A CLI helper tool for Puppet's vmpooler to help you stay afloat" + program :description, "A CLI helper tool for Puppet's vmpooler to help you stay afloat.\n\nConfiguration may be placed in a ~/.vmfloaty.yml file." config = Conf.read_config From 9a44cc480efda5d817665f44eaa67e87cb8db731 Mon Sep 17 00:00:00 2001 From: Nate Wolfe Date: Mon, 24 Aug 2020 12:11:06 -0700 Subject: [PATCH 3/3] (maint) Add --user CLI option on delete and list subcommands To support usage without a configuration file. --- lib/vmfloaty.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 7734778..b2fb65a 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -90,6 +90,7 @@ class Vmfloaty c.option '--json', 'Prints information as JSON' c.option '--token STRING', String, 'Token for pooler service' c.option '--url STRING', String, 'URL of pooler service' + c.option '--user STRING', String, 'User to authenticate with' c.action do |args, options| verbose = options.verbose || config['verbose'] @@ -212,6 +213,7 @@ class Vmfloaty c.option '--json', 'Outputs hosts scheduled for deletion as JSON' c.option '--token STRING', String, 'Token for pooler service' c.option '--url STRING', String, 'URL of pooler service' + c.option '--user STRING', String, 'User to authenticate with' c.action do |args, options| verbose = options.verbose || config['verbose'] service = Service.new(options, config)