lib/mb/cli/sub_command/plugin.rb in motherbrain-0.14.4 vs lib/mb/cli/sub_command/plugin.rb in motherbrain-0.14.5

- old
+ new

@@ -59,10 +59,11 @@ type: :hash, desc: "The component versions to set with default attributes", aliases: "--components" method_option :cookbook_versions, type: :hash, + hidden: true, desc: "The cookbook versions to set on the environment", aliases: "--cookbooks" method_option :environment_attributes, type: :hash, desc: "Any additional attributes to set on the environment", @@ -82,10 +83,12 @@ desc("bootstrap MANIFEST", "Bootstrap a manifest of node groups") define_method(:bootstrap) do |manifest_file| boot_options = Hash.new.merge(options).deep_symbolize_keys manifest = MB::Bootstrap::Manifest.from_file(manifest_file) + cookbooks_option_deprecated(options) + job = bootstrapper.async_bootstrap( environment.freeze, manifest.freeze, plugin.freeze, boot_options.freeze @@ -101,10 +104,11 @@ type: :hash, desc: "The component versions to set with default attributes", aliases: "--components" method_option :cookbook_versions, type: :hash, + hidden: true, desc: "The cookbook versions to set on the environment", aliases: "--cookbooks" method_option :environment_attributes, type: :hash, desc: "Any additional attributes to set on the environment", @@ -127,10 +131,12 @@ desc("provision MANIFEST", "Create a cluster of nodes and add them to a Chef environment") define_method(:provision) do |manifest_file| prov_options = Hash.new.merge(options).deep_symbolize_keys manifest = Provisioner::Manifest.from_file(manifest_file) + cookbooks_option_deprecated(options) + job = provisioner.async_provision( environment.freeze, manifest.freeze, plugin.freeze, prov_options.freeze @@ -168,10 +174,11 @@ type: :hash, desc: "The component versions to set with default attributes", aliases: "--components" method_option :cookbook_versions, type: :hash, + hide: true, desc: "The cookbook versions to set on the environment", aliases: "--cookbooks" method_option :environment_attributes, type: :hash, desc: "Any additional attributes to set on the environment", @@ -194,16 +201,11 @@ desc: "The upgrade will be constrained to the order defined in the plugin's stack_order." desc("upgrade", "Upgrade an environment to the specified versions") define_method(:upgrade) do upgrade_options = Hash.new.merge(options).deep_symbolize_keys - requires_one_of [ - :component_versions, - :cookbook_versions, - :environment_attributes, - :environment_attributes_file - ] + cookbooks_option_deprecated(options) job = upgrade_manager.async_upgrade( environment.freeze, plugin.freeze, upgrade_options.freeze @@ -216,9 +218,17 @@ define_method(:attributes) do ui.say "\n" ui.say "** listing attributes for #{plugin}:" ui.say "\n" ui.say plugin.metadata.attributes.to_yaml + end + end + + no_commands do + def cookbooks_option_deprecated(options) + if options[:cookbook_versions] + ui.deprecated "--cookbooks option is deprecated in favor of loading versions from Berksfile.lock" + end end end end klass