-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathplugin.rb
48 lines (39 loc) · 1.37 KB
/
plugin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
Vagrant.require 'vagrant_cloud'
require Vagrant.source_root.join("plugins/commands/cloud/util")
require Vagrant.source_root.join("plugins/commands/cloud/client/client")
module VagrantPlugins
module CloudCommand
class Plugin < Vagrant.plugin("2")
name "vagrant-cloud"
description <<-DESC
Provides the cloud command and internal API access to Vagrant Cloud.
DESC
command(:cloud) do
require_relative "root"
init!
Command::Root
end
action_hook(:cloud_authenticated_boxes, :authenticate_box_url) do |hook|
require_relative "auth/middleware/add_authentication"
hook.prepend(AddAuthentication)
end
action_hook(:cloud_authenticated_boxes, :authenticate_box_downloader) do |hook|
require_relative "auth/middleware/add_downloader_authentication"
hook.prepend(AddDownloaderAuthentication)
end
protected
def self.init!
# Set this to match Vagant logging level so we get
# desired request/response information within the
# logger output
ENV["VAGRANT_CLOUD_LOG"] = Vagrant.log_level
return if defined?(@_init)
I18n.load_path << File.expand_path("../locales/en.yml", __FILE__)
I18n.reload!
@_init = true
end
end
end
end