From e7d8e2aa99f3bb47a39541627dd82f9009ee8747 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Thu, 4 May 2023 03:15:32 +0200 Subject: [PATCH] Client: remove useless reference to authd + add a mocked zone del function. --- src/client/main.cr | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/client/main.cr b/src/client/main.cr index 08c8eb4..6cd6db4 100644 --- a/src/client/main.cr +++ b/src/client/main.cr @@ -25,11 +25,12 @@ end class Actions property the_call = {} of String => Proc(Nil) property dnsmanagerd : DNSManager::Client - property authd : AuthD::Client - property authd_config : Baguette::Configuration::Auth + #property authd : AuthD::Client + #property authd_config : Baguette::Configuration::Auth + property authd_key : String? property config : Baguette::Configuration::DNSManager - def initialize(@dnsmanagerd, @authd, @authd_config, @config) + def initialize(@dnsmanagerd, @config, @authd_key) # # Admin section. # @@ -37,6 +38,7 @@ class Actions # Maintainance @the_call["admin-maintainance"] = ->admin_maintainance @the_call["user-zone-add"] = ->user_zone_add + @the_call["user-zone-del"] = ->user_zone_del end def admin_maintainance @@ -51,17 +53,15 @@ class Actions next end - key = @authd_config.shared_key - if past_is_verbosity sub = DNSManager::Request::Maintainance::Subject::Verbosity value = subject.to_i pp! sub, value - pp! @dnsmanagerd.admin_maintainance key, sub, value + pp! @dnsmanagerd.admin_maintainance authd_key.not_nil!, sub, value else sub = DNSManager::Request::Maintainance::Subject.parse(subject) pp! sub - pp! @dnsmanagerd.admin_maintainance key, sub + pp! @dnsmanagerd.admin_maintainance authd_key.not_nil!, sub end rescue e puts "error for admin_maintainance #{subject}: #{e.message}" @@ -80,6 +80,19 @@ class Actions end end end + + def user_zone_del + domains = Context.args.not_nil! + domains.each do |domain| + begin + pp! domain + #pp! @dnsmanagerd.user_zone_del domain + rescue e + puts "error for user_zone_del: #{e.message}" + end + end + end + end def main @@ -133,8 +146,8 @@ def main dnsmanagerd.login token end - authd = AuthD::Client.new - actions = Actions.new dnsmanagerd, authd, authd_config, config + #authd = AuthD::Client.new + actions = Actions.new dnsmanagerd, config, authd_config.pass # Now we did read the intent, we should proceed doing what was asked. begin @@ -145,7 +158,7 @@ def main # dnsmanagerd disconnection dnsmanagerd.close - authd.close + #authd.close rescue e Baguette::Log.info "Exception: #{e}" end