diff --git a/lib/core/generator/generic/templates/objname_factory_.vtemplate b/lib/core/generator/generic/templates/objname_factory_.vtemplate index a82d5faa..ac90148c 100644 --- a/lib/core/generator/generic/templates/objname_factory_.vtemplate +++ b/lib/core/generator/generic/templates/objname_factory_.vtemplate @@ -169,7 +169,11 @@ pub fn play(mut plbook PlayBook) ! { @if args.cat == .installer mut other_actions := plbook.find(filter: '${args.name}.')! for mut other_action in other_actions { + @if args.startupmanager + if other_action.name in ["destroy","install","build","start","stop","restart","start_pre","start_post","stop_pre","stop_post"]{ + @else if other_action.name in ["destroy","install","build"]{ + @end mut p := other_action.params name := p.get_default('name', 'default')! reset:=p.get_default_false("reset") @@ -188,13 +192,7 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug("install action ${args.name}.build") ${args.name}_obj.build()! } - } - @if args.startupmanager - if other_action.name in ["start","stop","restart","start_pre","start_post","stop_pre","stop_post"]{ - mut p := other_action.params - name := p.get('name')! - mut ${args.name}_obj:=get(name:name)! - console.print_debug("action object:\n??{${args.name}_obj}") + @if args.startupmanager if other_action.name == "start"{ console.print_debug("install action ${args.name}.??{other_action.name}") ${args.name}_obj.start()! @@ -223,8 +221,8 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug("install action ${args.name}.??{other_action.name}") ${args.name}_obj.stop_post()! } + @end } - @end other_action.done = true } @end diff --git a/lib/installers/horus/coordinator/coordinator_factory_.v b/lib/installers/horus/coordinator/coordinator_factory_.v index 367748f9..b44b3d0e 100644 --- a/lib/installers/horus/coordinator/coordinator_factory_.v +++ b/lib/installers/horus/coordinator/coordinator_factory_.v @@ -38,13 +38,13 @@ pub fn new(args ArgsGet) !&Coordinator { log_level: args.log_level repo_path: args.repo_path } - + // Try to set in Redis, if it fails (Redis not available), use in-memory config set(obj) or { console.print_debug('Redis not available, using in-memory configuration') set_in_mem(obj)! } - + return get(name: args.name)! } @@ -154,13 +154,13 @@ 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'] { + 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)! console.print_debug('action object:\n${coordinator_obj}') - + if other_action.name == 'destroy' || reset { console.print_debug('install action coordinator.destroy') coordinator_obj.destroy()! @@ -173,12 +173,6 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug('install action coordinator.build') coordinator_obj.build()! } - } - if other_action.name in ['start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { - mut p := other_action.params - name := p.get('name')! - mut coordinator_obj := get(name: name)! - console.print_debug('action object:\n${coordinator_obj}') if other_action.name == 'start' { console.print_debug('install action coordinator.${other_action.name}') coordinator_obj.start()! diff --git a/lib/installers/horus/herorunner/herorunner_factory_.v b/lib/installers/horus/herorunner/herorunner_factory_.v index 27f7d13b..b681c0b2 100644 --- a/lib/installers/horus/herorunner/herorunner_factory_.v +++ b/lib/installers/horus/herorunner/herorunner_factory_.v @@ -142,7 +142,7 @@ 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'] { + 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') @@ -161,12 +161,6 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug('install action herorunner.build') herorunner_obj.build()! } - } - if other_action.name in ['start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { - mut p := other_action.params - name := p.get('name')! - mut herorunner_obj := get(name: name)! - console.print_debug('action object:\n${herorunner_obj}') if other_action.name == 'start' { console.print_debug('install action herorunner.${other_action.name}') herorunner_obj.start()! diff --git a/lib/installers/horus/osirisrunner/osirisrunner_factory_.v b/lib/installers/horus/osirisrunner/osirisrunner_factory_.v index 0ff3673b..9a0ee0ab 100644 --- a/lib/installers/horus/osirisrunner/osirisrunner_factory_.v +++ b/lib/installers/horus/osirisrunner/osirisrunner_factory_.v @@ -144,7 +144,7 @@ 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'] { + 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') @@ -163,12 +163,6 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug('install action osirisrunner.build') osirisrunner_obj.build()! } - } - if other_action.name in ['start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { - mut p := other_action.params - name := p.get('name')! - mut osirisrunner_obj := get(name: name)! - console.print_debug('action object:\n${osirisrunner_obj}') if other_action.name == 'start' { console.print_debug('install action osirisrunner.${other_action.name}') osirisrunner_obj.start()! diff --git a/lib/installers/horus/salrunner/salrunner_factory_.v b/lib/installers/horus/salrunner/salrunner_factory_.v index 169c3452..4be86568 100644 --- a/lib/installers/horus/salrunner/salrunner_factory_.v +++ b/lib/installers/horus/salrunner/salrunner_factory_.v @@ -144,7 +144,7 @@ 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'] { + 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') @@ -163,12 +163,6 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug('install action salrunner.build') salrunner_obj.build()! } - } - if other_action.name in ['start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { - mut p := other_action.params - name := p.get('name')! - mut salrunner_obj := get(name: name)! - console.print_debug('action object:\n${salrunner_obj}') if other_action.name == 'start' { console.print_debug('install action salrunner.${other_action.name}') salrunner_obj.start()! diff --git a/lib/installers/horus/supervisor/supervisor_factory_.v b/lib/installers/horus/supervisor/supervisor_factory_.v index cd5ef0be..d4fc62a4 100644 --- a/lib/installers/horus/supervisor/supervisor_factory_.v +++ b/lib/installers/horus/supervisor/supervisor_factory_.v @@ -148,7 +148,7 @@ 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'] { + 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') @@ -167,12 +167,6 @@ pub fn play(mut plbook PlayBook) ! { console.print_debug('install action supervisor.build') supervisor_obj.build()! } - } - if other_action.name in ['start', 'stop', 'restart', 'start_pre', 'start_post', 'stop_pre', 'stop_post'] { - mut p := other_action.params - name := p.get('name')! - mut supervisor_obj := get(name: name)! - console.print_debug('action object:\n${supervisor_obj}') if other_action.name == 'start' { console.print_debug('install action supervisor.${other_action.name}') supervisor_obj.start()! @@ -319,7 +313,6 @@ pub fn (mut self Supervisor) running() !bool { return self.running_check()! } - // switch instance to be used for supervisor pub fn switch(name string) { supervisor_default = name