diff --git a/plugins/commands/serve/util.rb b/plugins/commands/serve/util.rb index 3e102ea40..e4d9d4558 100644 --- a/plugins/commands/serve/util.rb +++ b/plugins/commands/serve/util.rb @@ -8,6 +8,7 @@ module VagrantPlugins autoload :HasBroker, Vagrant.source_root.join("plugins/commands/serve/util/has_broker").to_s autoload :HasLogger, Vagrant.source_root.join("plugins/commands/serve/util/has_logger").to_s autoload :HasMapper, Vagrant.source_root.join("plugins/commands/serve/util/has_mapper").to_s + autoload :HasSeeds, Vagrant.source_root.join("plugins/commands/serve/util/has_seeds").to_s autoload :ServiceInfo, Vagrant.source_root.join("plugins/commands/serve/util/service_info").to_s module WithMapper diff --git a/plugins/commands/serve/util/has_seeds.rb b/plugins/commands/serve/util/has_seeds.rb new file mode 100644 index 000000000..b1b441faf --- /dev/null +++ b/plugins/commands/serve/util/has_seeds.rb @@ -0,0 +1,34 @@ +module VagrantPlugins + module CommandServe + module Util + module HasSeeds + # Provides seed value registration. + module Service + def seed(req, ctx) + logger.info("ruby side received seed through service - #{req.inspect}") + @seeds = req + Empty.new + end + + def seeds(req, ctx) + logger.info("ruby side received seed request through service - #{@seeds.inspect}") + return SDK::Args::Seeds.new if @seeds.nil? + @seeds + end + end + + # Provides seed access. + module Client + def seed(*args) + raise NotImplementedError, + "Seeding is currently not supported via Ruby client" + end + + def seeds + client.seeds(Empty.new) + end + end + end + end + end +end