ConfigLMM 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +5 -0
- data/Examples/Android.mm.yaml +8 -0
- data/Examples/Apps/Blog.mm.yaml +7 -0
- data/Examples/Apps/Jellyfin.mm.yaml +3 -0
- data/Examples/Implemented.mm.yaml +155 -0
- data/Examples/Keys.ini +7 -0
- data/Examples/Linux.mm.yaml +16 -0
- data/Examples/Windows.mm.yaml +11 -0
- data/Examples/configlmmAuth.sh +26 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.conf.erb +38 -0
- data/Plugins/Apps/ArchiSteamFarm/ArchiSteamFarm.lmm.rb +19 -0
- data/Plugins/Apps/IPFS/IPFS.conf.erb +44 -0
- data/Plugins/Apps/IPFS/IPFS.lmm.rb +23 -0
- data/Plugins/Apps/InfluxDB/InfluxDB.conf.erb +34 -0
- data/Plugins/Apps/InfluxDB/InfluxDB.lmm.rb +19 -0
- data/Plugins/Apps/Jackett/Jackett.conf.erb +38 -0
- data/Plugins/Apps/Jackett/Jackett.lmm.rb +19 -0
- data/Plugins/Apps/Jellyfin/Jellyfin.conf.erb +59 -0
- data/Plugins/Apps/Jellyfin/Jellyfin.lmm.rb +23 -0
- data/Plugins/Apps/Mastodon/Mastodon.conf.erb +81 -0
- data/Plugins/Apps/Mastodon/Mastodon.lmm.rb +23 -0
- data/Plugins/Apps/Matrix/Matrix.conf.erb +36 -0
- data/Plugins/Apps/Matrix/Matrix.lmm.rb +23 -0
- data/Plugins/Apps/Netdata/Netdata.conf.erb +37 -0
- data/Plugins/Apps/Netdata/Netdata.lmm.rb +23 -0
- data/Plugins/Apps/Nextcloud/Nextcloud.conf.erb +165 -0
- data/Plugins/Apps/Nextcloud/Nextcloud.lmm.rb +23 -0
- data/Plugins/Apps/Nginx/config-lmm/errors.conf +31 -0
- data/Plugins/Apps/Nginx/config-lmm/private.conf +6 -0
- data/Plugins/Apps/Nginx/config-lmm/proxy.conf +15 -0
- data/Plugins/Apps/Nginx/config-lmm/public.conf +3 -0
- data/Plugins/Apps/Nginx/config-lmm/ssl.conf +18 -0
- data/Plugins/Apps/Nginx/main.conf +30 -0
- data/Plugins/Apps/Nginx/nginx.conf +90 -0
- data/Plugins/Apps/Nginx/nginx.lmm.rb +62 -0
- data/Plugins/Apps/Nginx/proxy.conf.erb +31 -0
- data/Plugins/Apps/Odoo/Odoo.conf.erb +44 -0
- data/Plugins/Apps/Odoo/Odoo.lmm.rb +23 -0
- data/Plugins/Apps/Pterodactyl/Pterodactyl.conf.erb +50 -0
- data/Plugins/Apps/Pterodactyl/Pterodactyl.lmm.rb +30 -0
- data/Plugins/Apps/Pterodactyl/Wings.conf.erb +38 -0
- data/Plugins/Apps/Sunshine/Sunshine.conf.erb +31 -0
- data/Plugins/Apps/Sunshine/Sunshine.lmm.rb +21 -0
- data/Plugins/Apps/Vaultwarden/Vaultwarden.conf.erb +48 -0
- data/Plugins/Apps/Vaultwarden/Vaultwarden.lmm.rb +25 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.conf.erb +35 -0
- data/Plugins/Apps/bitmagnet/bitmagnet.lmm.rb +19 -0
- data/Plugins/Apps/gollum/config.ru +11 -0
- data/Plugins/Apps/gollum/gollum.conf.erb +41 -0
- data/Plugins/Apps/gollum/gollum.lmm.rb +52 -0
- data/Plugins/OS/Linux.lmm.rb +64 -0
- data/Plugins/OS/Routers/Aruba/ArubaInstant.lmm.rb +144 -0
- data/Plugins/Platforms/GitHub.lmm.rb +57 -0
- data/Plugins/Platforms/GoDaddy/GoDaddy.lmm.rb +83 -0
- data/Plugins/Platforms/GoDaddy/zone.txt.erb +13 -0
- data/Plugins/Platforms/porkbun.lmm.rb +129 -0
- data/Plugins/Platforms/porkbun_spec.rb +110 -0
- data/Plugins/Services/DNS/AmberBit.lmm.rb +14 -0
- data/Plugins/Services/DNS/ArubaItDNS.lmm.rb +14 -0
- data/Plugins/Services/DNS/NICLV.lmm.rb +18 -0
- data/Plugins/Services/DNS/PowerDNS.lmm.rb +261 -0
- data/Plugins/Services/DNS/tonic.lmm.rb +126 -0
- data/README.md +337 -0
- data/Rakefile +15 -0
- data/UNLICENSE +24 -0
- data/bin/configlmm +7 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/lib/ConfigLMM/Framework/plugins/dns.rb +63 -0
- data/lib/ConfigLMM/Framework/plugins/errors.rb +23 -0
- data/lib/ConfigLMM/Framework/plugins/nginxApp.rb +55 -0
- data/lib/ConfigLMM/Framework/plugins/plugin.rb +167 -0
- data/lib/ConfigLMM/Framework/plugins/ssh.rb +37 -0
- data/lib/ConfigLMM/Framework/plugins/store.rb +57 -0
- data/lib/ConfigLMM/Framework/plugins.rb +5 -0
- data/lib/ConfigLMM/Framework/registrator.rb +32 -0
- data/lib/ConfigLMM/Framework.rb +9 -0
- data/lib/ConfigLMM/LMM/plugins.rb +5 -0
- data/lib/ConfigLMM/LMM.rb +8 -0
- data/lib/ConfigLMM/cli.rb +161 -0
- data/lib/ConfigLMM/command.rb +53 -0
- data/lib/ConfigLMM/commands/build.rb +41 -0
- data/lib/ConfigLMM/commands/cleanup.rb +30 -0
- data/lib/ConfigLMM/commands/configsCommand.rb +167 -0
- data/lib/ConfigLMM/commands/deploy.rb +39 -0
- data/lib/ConfigLMM/commands/diff.rb +45 -0
- data/lib/ConfigLMM/commands/list.rb +15 -0
- data/lib/ConfigLMM/commands/refresh.rb +46 -0
- data/lib/ConfigLMM/commands/types.rb +35 -0
- data/lib/ConfigLMM/commands/validate.rb +49 -0
- data/lib/ConfigLMM/context.rb +52 -0
- data/lib/ConfigLMM/io/configList.rb +98 -0
- data/lib/ConfigLMM/io/path.rb +48 -0
- data/lib/ConfigLMM/io/source.rb +47 -0
- data/lib/ConfigLMM/io.rb +2 -0
- data/lib/ConfigLMM/state.rb +78 -0
- data/lib/ConfigLMM/utils/filters.rb +126 -0
- data/lib/ConfigLMM/version.rb +5 -0
- data/lib/ConfigLMM.rb +6 -0
- data/sig/ConfigLMM.rbs +4 -0
- metadata +485 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
require 'octokit'
|
|
3
|
+
|
|
4
|
+
module ConfigLMM
|
|
5
|
+
module LMM
|
|
6
|
+
class GitHub < Framework::Plugin
|
|
7
|
+
|
|
8
|
+
def actionGitHubOrganizationRefresh(id, target, activeState, context, options)
|
|
9
|
+
|
|
10
|
+
client = Octokit::Client.new(:access_token => ENV['GITHUB_TOKEN'])
|
|
11
|
+
orgs = client.organizations.select { |org| org[:login] == target['Name'] }
|
|
12
|
+
if orgs.empty?
|
|
13
|
+
prompt.say("Didn\'t find organization with name #{target['Name']}")
|
|
14
|
+
prompt.say('You need to create it manually - https://github.com/organizations/plan')
|
|
15
|
+
raise Framework::PluginPrerequisite.new('Organization must exist!')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
raise "This shouldn't happen!" if orgs.length != 1
|
|
19
|
+
|
|
20
|
+
activeState.clear
|
|
21
|
+
|
|
22
|
+
orgs.first.each do |name, value|
|
|
23
|
+
activeState[name.to_s] = value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def actionGitHubOrganizationDiff(id, target, activeState, context, options)
|
|
28
|
+
shouldMatch(id, 'Name', 'login', target, activeState)
|
|
29
|
+
shouldMatch(id, 'Description', 'description', target, activeState)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def actionGitHubOrganizationDeploy(id, target, activeState, context, options)
|
|
33
|
+
actionGitHubOrganizationDiff(id, target, activeState, context, options)
|
|
34
|
+
diff.each do |name, states|
|
|
35
|
+
if name == 'Name'
|
|
36
|
+
# TODO
|
|
37
|
+
elsif name == 'Description'
|
|
38
|
+
# TODO
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
# TODO FIXME
|
|
42
|
+
raise 'Not implemented!'
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def authenticate(actionMethod, target, activeState, context, options)
|
|
46
|
+
authToken = ENV['GITHUB_TOKEN']
|
|
47
|
+
if authToken.to_s.empty?
|
|
48
|
+
prompt.say('Open https://github.com/settings/tokens and create a token!')
|
|
49
|
+
prompt.say('Then set it\'s value to GITHUB_TOKEN as Environment Variable')
|
|
50
|
+
raise Framework::PluginPrerequisite.new('Need GITHUB_TOKEN!')
|
|
51
|
+
end
|
|
52
|
+
true
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
require 'http'
|
|
3
|
+
require 'addressable/idna'
|
|
4
|
+
|
|
5
|
+
module ConfigLMM
|
|
6
|
+
module LMM
|
|
7
|
+
class GoDaddy < Framework::DNS
|
|
8
|
+
|
|
9
|
+
API_DOMAIN = 'https://api.godaddy.com'
|
|
10
|
+
TEST_API_DOMAIN = 'https://api.ote-godaddy.com'
|
|
11
|
+
# Looks like GoDaddy is garbage and doesn't let people with few domains to use their API
|
|
12
|
+
USE_API = false
|
|
13
|
+
|
|
14
|
+
# TODO
|
|
15
|
+
# def actionGoDaddyDNSValidate(id, target, activeState, context, options)
|
|
16
|
+
# We should check that target['DNS'] looks like valid config
|
|
17
|
+
# end
|
|
18
|
+
|
|
19
|
+
def actionGoDaddyDNSBuild(id, target, activeState, context, options)
|
|
20
|
+
outputFolder = options['output'] + '/' + id + '/'
|
|
21
|
+
|
|
22
|
+
template = ERB.new(File.read(__dir__ + '/zone.txt.erb'))
|
|
23
|
+
|
|
24
|
+
target['DNS'].each do |domain, data|
|
|
25
|
+
config = { 'Domain' => domain, 'Records' => '' }
|
|
26
|
+
data.each do |name, data|
|
|
27
|
+
self.processDNS(domain, data).each do |type, records|
|
|
28
|
+
records.each do |record|
|
|
29
|
+
shortName = name
|
|
30
|
+
config['Records'] += [shortName, record[:ttl], ' IN ', record[:type], record[:content]].join("\t") + "\n"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
renderTemplate(template, config, outputFolder + domain + '.txt', options)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def actionGoDaddyDNSRefresh(id, target, activeState, context, options)
|
|
39
|
+
if USE_API
|
|
40
|
+
http = HTTP.auth("sso-key #{ENV['GODADDY_SECRET']}")
|
|
41
|
+
apiDomain = (options['dry'] || target['Test']) ? TEST_API_DOMAIN : API_DOMAIN
|
|
42
|
+
|
|
43
|
+
target['DNS'].each do |domain, records|
|
|
44
|
+
response = http.get("#{apiDomain}/v1/domains/#{Addressable::IDNA.to_ascii(domain)}/records")
|
|
45
|
+
# TODO
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# TODO
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# TODO
|
|
53
|
+
# def actionGoDaddyDNSDiff(id, target, activeState, context, options)
|
|
54
|
+
# end
|
|
55
|
+
|
|
56
|
+
persistBuildDir
|
|
57
|
+
|
|
58
|
+
def actionGoDaddyDNSDeploy(id, target, activeState, context, options)
|
|
59
|
+
#actionGoDaddyDNSDiff(id, target, activeState, context, options)
|
|
60
|
+
if USE_API
|
|
61
|
+
# TODO
|
|
62
|
+
else
|
|
63
|
+
showManualDNSSteps(target, "Click on DNS tab and either import generated Zone file or add these records:") do |domain|
|
|
64
|
+
prompt.say("Open https://dcc.godaddy.com/control/portfolio/#{domain}/settings", :color => :magenta)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def authenticate(actionMethod, target, activeState, context, options)
|
|
70
|
+
if USE_API
|
|
71
|
+
authSecret = ENV['GODADDY_SECRET']
|
|
72
|
+
if authSecret.to_s.empty?
|
|
73
|
+
prompt.say('Open https://developer.godaddy.com/keys and create API Key!')
|
|
74
|
+
prompt.say('Then set "KEY:SECRET" to GODADDY_SECRET as Environment Variable')
|
|
75
|
+
raise Framework::PluginPrerequisite.new('Need GODADDY_SECRET')
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'porkbun'
|
|
4
|
+
|
|
5
|
+
module ConfigLMM
|
|
6
|
+
module LMM
|
|
7
|
+
class Porkbun < Framework::DNS
|
|
8
|
+
|
|
9
|
+
def actionPorkbunDNSValidate(id, target, activeState, context, options)
|
|
10
|
+
errors = []
|
|
11
|
+
if target['DNS'].to_h.empty?
|
|
12
|
+
errors << id + ': DNS entries must be provided!'
|
|
13
|
+
end
|
|
14
|
+
errors
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def actionPorkbunDNSRefresh(id, target, activeState, context, options)
|
|
18
|
+
result = ::Porkbun::Domain.list_all
|
|
19
|
+
if result[:status] == "SUCCESS"
|
|
20
|
+
domainsInfo = result[:domains].map { |info| [ info[:domain], { :_meta_ => info } ] }.flatten
|
|
21
|
+
activeState['DNS'] = Hash[*domainsInfo]
|
|
22
|
+
activeState['DNS'].each do |domain, info|
|
|
23
|
+
records = ::Porkbun::DNS.retrieve(domain)
|
|
24
|
+
if records.instance_of?(::Porkbun::Error)
|
|
25
|
+
if records.message.include?('Domain is not opted in to API access')
|
|
26
|
+
prompt.warn("#{domain}: Skipping, #{records.message}")
|
|
27
|
+
else
|
|
28
|
+
raise Framework::PluginProcessError.new("Got error " + records.message)
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
info[:_records_] = records.map { |record| record.to_h }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
else
|
|
35
|
+
raise Framework::PluginProcessError.new("Couldn't refresh " + id + "! Invalid PORKBUN_SECRET_API_KEY ?")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def actionPorkbunDNSDiff(id, target, activeState, context, options)
|
|
40
|
+
# TODO
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def actionPorkbunDNSDeploy(id, target, activeState, context, options)
|
|
44
|
+
if target['DNS'].to_h.empty?
|
|
45
|
+
raise Framework::PluginProcessError.new(id + ': DNS entries must be provided!')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
actionPorkbunDNSDiff(id, target, activeState, context, options)
|
|
49
|
+
|
|
50
|
+
target['DNS'].each do |domain, info|
|
|
51
|
+
presentRecords = ::Porkbun::DNS.retrieve(domain)
|
|
52
|
+
if presentRecords.instance_of?(::Porkbun::Error)
|
|
53
|
+
raise Framework::PluginProcessError.new("#{id}: #{domain} - #{result.message}")
|
|
54
|
+
end
|
|
55
|
+
activeState['DNS'] ||= {}
|
|
56
|
+
activeState['DNS'][domain] ||= {}
|
|
57
|
+
activeState['DNS'][domain][:_records_] = presentRecords.map { |record| record.to_h }
|
|
58
|
+
|
|
59
|
+
info.each do |name, data|
|
|
60
|
+
name = '' if name == '@'
|
|
61
|
+
|
|
62
|
+
self.processDNS(domain, data).each do |type, records|
|
|
63
|
+
records.each do |record|
|
|
64
|
+
found = false
|
|
65
|
+
remove = []
|
|
66
|
+
presentRecords.each do |dns|
|
|
67
|
+
if (dns.name.downcase == ((name.empty? ? '' : name + '.') + domain).downcase)
|
|
68
|
+
# * Skip when content matches
|
|
69
|
+
# * When setting A/AAAA record we need to delete ALIAS
|
|
70
|
+
# * When setting ALIAS we need to delete A/AAAA record
|
|
71
|
+
if (dns.type == type && dns.content == record[:content])
|
|
72
|
+
found = true
|
|
73
|
+
elsif (type[0] == 'A' && dns.type == 'ALIAS') ||
|
|
74
|
+
(type == 'ALIAS' && dns.type == 'A') ||
|
|
75
|
+
(type == 'ALIAS' && dns.type == 'AAAA')
|
|
76
|
+
remove << dns
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
remove.each do |dns|
|
|
82
|
+
dns.delete
|
|
83
|
+
# TODO should also remove from activeState
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if !found
|
|
87
|
+
prompt.say("Updating " + ((name.empty? || name == '@')? '' : name + '.') + domain)
|
|
88
|
+
result = ::Porkbun::DNS.create(domain: domain,
|
|
89
|
+
name: name,
|
|
90
|
+
type: record[:type],
|
|
91
|
+
content: record[:content],
|
|
92
|
+
ttl: record[:ttl]
|
|
93
|
+
)
|
|
94
|
+
if result.message.to_s.include?('unable')
|
|
95
|
+
raise Framework::PluginProcessError.new("#{id}: #{name} #{domain} - #{result.message}")
|
|
96
|
+
else
|
|
97
|
+
result = result.to_h
|
|
98
|
+
name = result[:name]
|
|
99
|
+
result[:name] = (result[:name].empty? ? '' : result[:name] + '.') + domain
|
|
100
|
+
name = '@' if name.empty?
|
|
101
|
+
activeState['DNS'][domain][name] = result
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def cleanup(configs, state, context, options)
|
|
111
|
+
# TODO
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def authenticate(actionMethod, target, activeState, context, options)
|
|
115
|
+
if ENV['PORKBUN_API_KEY'].to_s.empty? || ENV['PORKBUN_SECRET_API_KEY'].to_s.empty?
|
|
116
|
+
prompt.error('Set your porkbun API key to PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY as Environment Variable')
|
|
117
|
+
raise Framework::PluginPrerequisite.new('Need PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY')
|
|
118
|
+
else
|
|
119
|
+
result = ::Porkbun.ping
|
|
120
|
+
if result[:status] != 'SUCCESS'
|
|
121
|
+
raise Framework::PluginPrerequisite.new(result[:message])
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
true
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
|
|
2
|
+
require_relative('../../lib/ConfigLMM/commands/refresh')
|
|
3
|
+
require_relative('../../lib/ConfigLMM/commands/deploy')
|
|
4
|
+
require 'porkbun'
|
|
5
|
+
require 'tty-logger'
|
|
6
|
+
|
|
7
|
+
RSpec.describe 'Porkbun' do
|
|
8
|
+
|
|
9
|
+
let(:domains) {[
|
|
10
|
+
{
|
|
11
|
+
:domain => 'example.com'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
:domain => 'example.org'
|
|
15
|
+
}
|
|
16
|
+
]}
|
|
17
|
+
|
|
18
|
+
let(:target) {
|
|
19
|
+
{
|
|
20
|
+
'Type' => 'PorkbunDNS',
|
|
21
|
+
'DNS' => {
|
|
22
|
+
'example.org' => { '@' => 'A=@me' }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
it 'Refresh works' do
|
|
28
|
+
state = instance_double('ConfigLMM::State')
|
|
29
|
+
expect(ConfigLMM::State).to receive(:new).and_return(state)
|
|
30
|
+
expect(state).to receive(:create!)
|
|
31
|
+
expect(state).to receive(:item).twice.with('Porkbun').and_return({}) # Twice because we use it to validate result in test
|
|
32
|
+
expect(state).to receive(:save)
|
|
33
|
+
|
|
34
|
+
expect(::Porkbun).to receive(:ping).and_return({ :status => 'SUCCESS' })
|
|
35
|
+
expect(::Porkbun::Domain).to receive(:list_all).and_return({ :status => 'SUCCESS', :domains => domains })
|
|
36
|
+
expect(::Porkbun::DNS).to receive(:retrieve).with('example.com').and_return([{ :name => 'example.com' }])
|
|
37
|
+
expect(::Porkbun::DNS).to receive(:retrieve).with('example.org').and_return([{ :name => 'example.org',
|
|
38
|
+
:content => 'example.com',
|
|
39
|
+
:type => 'ALIAS'
|
|
40
|
+
}])
|
|
41
|
+
|
|
42
|
+
ENV['PORKBUN_API_KEY'] = 'whatever'
|
|
43
|
+
ENV['PORKBUN_SECRET_API_KEY'] = 'whatever'
|
|
44
|
+
ConfigLMM::Commands::Refresh.new('whatever.yaml', { :level => :info }).processConfig({'Porkbun' => target}, {})
|
|
45
|
+
|
|
46
|
+
expect(state.item('Porkbun')).to include({
|
|
47
|
+
'DNS' => {
|
|
48
|
+
'example.com' => {
|
|
49
|
+
:_meta_ => { :domain => 'example.com' },
|
|
50
|
+
:_records_=> [ { :name => 'example.com' } ]
|
|
51
|
+
},
|
|
52
|
+
'example.org' => {
|
|
53
|
+
:_meta_=> { :domain=>'example.org' },
|
|
54
|
+
:_records_=> [ {
|
|
55
|
+
:content => 'example.com',
|
|
56
|
+
:name => 'example.org',
|
|
57
|
+
:type => 'ALIAS'
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
:Type => 'PorkbunDNS'
|
|
63
|
+
})
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'Deploy works' do
|
|
67
|
+
state = instance_double('ConfigLMM::State')
|
|
68
|
+
expect(ConfigLMM::State).to receive(:new).and_return(state)
|
|
69
|
+
expect(state).to receive(:create!)
|
|
70
|
+
expect(state).to receive(:item).twice.with('Porkbun').and_return({}) # Twice because we use it to validate result in test
|
|
71
|
+
expect(state).to receive(:save)
|
|
72
|
+
expect(HTTP).to receive(:get).and_return(HTTP::Response.new(body: '127.0.0.1',
|
|
73
|
+
status: 200,
|
|
74
|
+
:version => '1.1',
|
|
75
|
+
request: nil))
|
|
76
|
+
|
|
77
|
+
expect(::Porkbun).to receive(:ping).and_return({ :status => 'SUCCESS' })
|
|
78
|
+
|
|
79
|
+
record = ::Porkbun::DNS.new({
|
|
80
|
+
name: '',
|
|
81
|
+
content: 'example.com',
|
|
82
|
+
type: 'ALIAS',
|
|
83
|
+
id: '12345',
|
|
84
|
+
domain: 'example.org'
|
|
85
|
+
})
|
|
86
|
+
expect(::Porkbun::DNS).to receive(:retrieve).with('example.org').and_return([record])
|
|
87
|
+
expect(::Porkbun::DNS).to receive(:create).with({
|
|
88
|
+
:content => "127.0.0.1",
|
|
89
|
+
:domain=>"example.org",
|
|
90
|
+
:name=>"",
|
|
91
|
+
:ttl=>600,
|
|
92
|
+
:type=>"A"
|
|
93
|
+
}).and_return(record)
|
|
94
|
+
|
|
95
|
+
ENV['PORKBUN_API_KEY'] = 'whatever'
|
|
96
|
+
ENV['PORKBUN_SECRET_API_KEY'] = 'whatever'
|
|
97
|
+
ConfigLMM::Commands::Deploy.new('whatever.yaml', { :level => :info }).processConfig({'Porkbun' => target}, {})
|
|
98
|
+
|
|
99
|
+
expect(state.item('Porkbun')['DNS']['example.org']).to include({ '@' => {
|
|
100
|
+
:content=>"example.com",
|
|
101
|
+
:domain => "example.org",
|
|
102
|
+
:id => "12345",
|
|
103
|
+
:name => "example.org",
|
|
104
|
+
:prio => nil,
|
|
105
|
+
:ttl => 600,
|
|
106
|
+
:type => "ALIAS"
|
|
107
|
+
}})
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
module ConfigLMM
|
|
3
|
+
module LMM
|
|
4
|
+
class AmberBit < Framework::DNS
|
|
5
|
+
|
|
6
|
+
def actionAmberBitDNSDeploy(id, target, activeState, context, options)
|
|
7
|
+
showManualDNSSteps(target, "Click on Technical information and add these records:") do |domain|
|
|
8
|
+
prompt.say("Open https://my.amberbit.eu/domain/list/ and under #{domain}", :color => :magenta)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
module ConfigLMM
|
|
3
|
+
module LMM
|
|
4
|
+
class ArubaItDNS < Framework::DNS
|
|
5
|
+
|
|
6
|
+
def actionArubaItDNSDeploy(id, target, activeState, context, options)
|
|
7
|
+
showManualDNSSteps(target, "then click on 'DNS and Name Server Management' and add these records:") do |domain|
|
|
8
|
+
prompt.say("Open https://admin.aruba.it/PannelloAdmin/LoginDomain.aspx and select #{domain}", :color => :magenta)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
require 'http'
|
|
4
|
+
require 'addressable/idna'
|
|
5
|
+
|
|
6
|
+
module ConfigLMM
|
|
7
|
+
module LMM
|
|
8
|
+
class NICLV < Framework::DNS
|
|
9
|
+
|
|
10
|
+
def actionNICLVDNSDeploy(id, target, activeState, context, options)
|
|
11
|
+
showManualDNSSteps(target, "and add these records:") do |domain|
|
|
12
|
+
prompt.say("Open https://www.nic.lv/client/topview/edit_domain?dname=#{domain}", :color => :magenta)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|