From 26528a889dc9adf5bb970cc09336c07b6d55333f Mon Sep 17 00:00:00 2001 From: Mahmoud-Emad Date: Thu, 20 Nov 2025 14:00:29 +0200 Subject: [PATCH] refactor: Update get calls and clean up debug - Add `create: true` to get calls - Remove commented-out print_backtrace - Remove debug print for socket closure --- lib/installers/horus/coordinator/coordinator_factory_.v | 5 +++-- lib/installers/horus/herorunner/herorunner_factory_.v | 7 ++++--- lib/installers/horus/osirisrunner/osirisrunner_factory_.v | 7 ++++--- lib/installers/horus/salrunner/salrunner_factory_.v | 7 ++++--- lib/installers/horus/supervisor/supervisor_factory_.v | 7 ++++--- lib/schemas/jsonrpc/transport_unixsocket.v | 2 -- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/installers/horus/coordinator/coordinator_factory_.v b/lib/installers/horus/coordinator/coordinator_factory_.v index b44b3d0e..8ff4cf80 100644 --- a/lib/installers/horus/coordinator/coordinator_factory_.v +++ b/lib/installers/horus/coordinator/coordinator_factory_.v @@ -154,11 +154,12 @@ pub fn play(mut plbook PlayBook) ! { } mut other_actions := plbook.find(filter: 'coordinator.')! for mut other_action in other_actions { - if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { + if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', + 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { mut p := other_action.params name := p.get_default('name', 'default')! reset := p.get_default_false('reset') - mut coordinator_obj := get(name: name)! + mut coordinator_obj := get(name: name, create: true)! console.print_debug('action object:\n${coordinator_obj}') if other_action.name == 'destroy' || reset { diff --git a/lib/installers/horus/herorunner/herorunner_factory_.v b/lib/installers/horus/herorunner/herorunner_factory_.v index b681c0b2..d9edf993 100644 --- a/lib/installers/horus/herorunner/herorunner_factory_.v +++ b/lib/installers/horus/herorunner/herorunner_factory_.v @@ -142,13 +142,14 @@ pub fn play(mut plbook PlayBook) ! { } mut other_actions := plbook.find(filter: 'herorunner.')! for mut other_action in other_actions { - if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { + if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', + 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { mut p := other_action.params name := p.get_default('name', 'default')! reset := p.get_default_false('reset') - mut herorunner_obj := get(name: name)! + mut herorunner_obj := get(name: name, create: true)! console.print_debug('action object:\n${herorunner_obj}') - + if other_action.name == 'destroy' || reset { console.print_debug('install action herorunner.destroy') herorunner_obj.destroy()! diff --git a/lib/installers/horus/osirisrunner/osirisrunner_factory_.v b/lib/installers/horus/osirisrunner/osirisrunner_factory_.v index 9a0ee0ab..fb6078e0 100644 --- a/lib/installers/horus/osirisrunner/osirisrunner_factory_.v +++ b/lib/installers/horus/osirisrunner/osirisrunner_factory_.v @@ -144,13 +144,14 @@ pub fn play(mut plbook PlayBook) ! { } mut other_actions := plbook.find(filter: 'osirisrunner.')! for mut other_action in other_actions { - if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { + if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', + 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { mut p := other_action.params name := p.get_default('name', 'default')! reset := p.get_default_false('reset') - mut osirisrunner_obj := get(name: name)! + mut osirisrunner_obj := get(name: name, create: true)! console.print_debug('action object:\n${osirisrunner_obj}') - + if other_action.name == 'destroy' || reset { console.print_debug('install action osirisrunner.destroy') osirisrunner_obj.destroy()! diff --git a/lib/installers/horus/salrunner/salrunner_factory_.v b/lib/installers/horus/salrunner/salrunner_factory_.v index 4be86568..f46c3f89 100644 --- a/lib/installers/horus/salrunner/salrunner_factory_.v +++ b/lib/installers/horus/salrunner/salrunner_factory_.v @@ -144,13 +144,14 @@ pub fn play(mut plbook PlayBook) ! { } mut other_actions := plbook.find(filter: 'salrunner.')! for mut other_action in other_actions { - if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { + if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', + 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { mut p := other_action.params name := p.get_default('name', 'default')! reset := p.get_default_false('reset') - mut salrunner_obj := get(name: name)! + mut salrunner_obj := get(name: name, create: true)! console.print_debug('action object:\n${salrunner_obj}') - + if other_action.name == 'destroy' || reset { console.print_debug('install action salrunner.destroy') salrunner_obj.destroy()! diff --git a/lib/installers/horus/supervisor/supervisor_factory_.v b/lib/installers/horus/supervisor/supervisor_factory_.v index 0f33c8b1..b0de38c1 100644 --- a/lib/installers/horus/supervisor/supervisor_factory_.v +++ b/lib/installers/horus/supervisor/supervisor_factory_.v @@ -153,11 +153,12 @@ pub fn play(mut plbook PlayBook) ! { } mut other_actions := plbook.find(filter: 'supervisor.')! for mut other_action in other_actions { - if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { + if other_action.name in ['destroy', 'install', 'build', 'start', 'stop', 'restart', + 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { mut p := other_action.params name := p.get_default('name', 'default')! reset := p.get_default_false('reset') - mut supervisor_obj := get(name: name)! + mut supervisor_obj := get(name: name, create: true)! console.print_debug('action object:\n${supervisor_obj}') if other_action.name == 'destroy' || reset { @@ -177,7 +178,7 @@ pub fn play(mut plbook PlayBook) ! { 'stop_post'] { mut p := other_action.params name := p.get('name')! - mut supervisor_obj := get(name: name)! + mut supervisor_obj := get(name: name, create: true)! console.print_debug('action object:\n${supervisor_obj}') if other_action.name == 'start' { console.print_debug('install action supervisor.${other_action.name}') diff --git a/lib/schemas/jsonrpc/transport_unixsocket.v b/lib/schemas/jsonrpc/transport_unixsocket.v index de683651..8860fd55 100644 --- a/lib/schemas/jsonrpc/transport_unixsocket.v +++ b/lib/schemas/jsonrpc/transport_unixsocket.v @@ -33,8 +33,6 @@ pub fn (mut t UnixSocketTransport) send(request string, params SendParams) !stri // Close the socket explicitly unix.shutdown(socket.sock.handle) socket.close() or {} - // print_backtrace() - console.print_debug('The server did not close the socket, we did timeout or there was other error.') } // Set timeout if specified