Add HasSeeds util module for client/service
This commit is contained in:
parent
6b37b7ba55
commit
262a4fa099
@ -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
|
||||
|
||||
34
plugins/commands/serve/util/has_seeds.rb
Normal file
34
plugins/commands/serve/util/has_seeds.rb
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user