From 8c0257649d694ed1d34773eaf12eb93345356a02 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 6 May 2023 23:18:59 +0200 Subject: [PATCH] s/Maintainance/Maintenance/ + secret auth key fixed (client). --- src/client/lib/dnsmanager-client.cr | 4 ++-- src/client/main.cr | 23 +++++++++++------------ src/client/parser.cr | 12 ++++++------ src/requests/admin.cr | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/client/lib/dnsmanager-client.cr b/src/client/lib/dnsmanager-client.cr index 542dfee..e61e476 100644 --- a/src/client/lib/dnsmanager-client.cr +++ b/src/client/lib/dnsmanager-client.cr @@ -43,8 +43,8 @@ class DNSManager::Client < IPC # Admin stuff. # - def admin_maintainance(key : String, subject : DNSManager::Request::Maintainance::Subject, value : Int32? = nil) - request = DNSManager::Request::Maintainance.new(key,subject) + def admin_maintenance(key : String, subject : DNSManager::Request::Maintenance::Subject, value : Int32? = nil) + request = DNSManager::Request::Maintenance.new(key,subject) if value request.value = value end diff --git a/src/client/main.cr b/src/client/main.cr index 6cd6db4..f48ff44 100644 --- a/src/client/main.cr +++ b/src/client/main.cr @@ -27,21 +27,21 @@ class Actions property dnsmanagerd : DNSManager::Client #property authd : AuthD::Client #property authd_config : Baguette::Configuration::Auth - property authd_key : String? + property authd_key : String? = nil property config : Baguette::Configuration::DNSManager - def initialize(@dnsmanagerd, @config, @authd_key) + def initialize(@dnsmanagerd, @config, @authd_key = nil) # # Admin section. # - # Maintainance - @the_call["admin-maintainance"] = ->admin_maintainance + # Maintenance + @the_call["admin-maintenance"] = ->admin_maintenance @the_call["user-zone-add"] = ->user_zone_add @the_call["user-zone-del"] = ->user_zone_del end - def admin_maintainance + def admin_maintenance subjects = Context.args.not_nil! past_is_verbosity = false subjects.each do |subject| @@ -54,17 +54,16 @@ class Actions end if past_is_verbosity - sub = DNSManager::Request::Maintainance::Subject::Verbosity + sub = DNSManager::Request::Maintenance::Subject::Verbosity value = subject.to_i - pp! sub, value - pp! @dnsmanagerd.admin_maintainance authd_key.not_nil!, sub, value + @dnsmanagerd.admin_maintenance authd_key.not_nil!, sub, value else - sub = DNSManager::Request::Maintainance::Subject.parse(subject) + sub = DNSManager::Request::Maintenance::Subject.parse(subject) pp! sub - pp! @dnsmanagerd.admin_maintainance authd_key.not_nil!, sub + pp! @dnsmanagerd.admin_maintenance authd_key.not_nil!, sub end rescue e - puts "error for admin_maintainance #{subject}: #{e.message}" + puts "error for admin_maintenance #{subject}: #{e.message}" end end end @@ -147,7 +146,7 @@ def main end #authd = AuthD::Client.new - actions = Actions.new dnsmanagerd, config, authd_config.pass + actions = Actions.new dnsmanagerd, config, authd_config.shared_key # Now we did read the intent, we should proceed doing what was asked. begin diff --git a/src/client/parser.cr b/src/client/parser.cr index 4d9b5e5..14b6a79 100644 --- a/src/client/parser.cr +++ b/src/client/parser.cr @@ -40,10 +40,10 @@ def parsing_cli(authd_config : Baguette::Configuration::Auth) puts parser case Context.command - when /admin-maintainance/ + when /admin-maintenance/ Baguette::Log.warning "should provide subjects to request" Baguette::Log.warning "as in:" - DNSManager::Request::Maintainance::Subject.names.each do |n| + DNSManager::Request::Maintenance::Subject.names.each do |n| Baguette::Log.warning "- #{n}" end end @@ -99,10 +99,10 @@ def parsing_cli(authd_config : Baguette::Configuration::Auth) opt_authd_admin.call parser, authd_config # Maintenance. - parser.on("maintainance", "Maintainance operation of the website.") do - Baguette::Log.info "Maintainance operation of the website." - Context.command = "admin-maintainance" - parser.banner = "COMMAND: admin maintainance subject [value]" + parser.on("maintenance", "Maintenance operation of the website.") do + Baguette::Log.info "Maintenance operation of the website." + Context.command = "admin-maintenance" + parser.banner = "COMMAND: admin maintenance subject [value]" unrecognized_args_to_context_args.call parser, nil, 1 end diff --git a/src/requests/admin.cr b/src/requests/admin.cr index cb44b51..6dc2348 100644 --- a/src/requests/admin.cr +++ b/src/requests/admin.cr @@ -1,7 +1,7 @@ class DNSManager::Request # Periodic actions to perform as an administrator. - IPC::JSON.message Maintainance, 7 do + IPC::JSON.message Maintenance, 7 do enum Subject Verbosity # Change the verbosity of dnsmanagerd. end @@ -28,5 +28,5 @@ class DNSManager::Request end end end - DNSManager.requests << Maintainance + DNSManager.requests << Maintenance end