Add HasSeeds util module for client/service

This commit is contained in:
Chris Roberts 2021-12-02 13:48:44 -08:00 committed by Paul Hinze
parent 6b37b7ba55
commit 262a4fa099
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 35 additions and 0 deletions

View File

@ -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

View File

@ -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