@@ -55,6 +55,7 @@ func (a *Autopilot) Start() {
5555
5656 // loads the services which are available for user to run
5757 a .SetLoadedPlugins ()
58+
5859 a .plugins_to_run = a .Settings .Riotpot .Start
5960
6061 // check if the build is local or containerized
@@ -70,12 +71,11 @@ func (a *Autopilot) Start() {
7071 if running_mode_decision == "manual" { // User has decided to provide plugins to run in interactive/manual way
7172
7273 // user needs to choose which plugins to choose from this list
73- fmt .Printf ("Plugins available to run " )
74+ fmt .Printf ("Plugins available to run are " )
7475 fmt .Println (a .loaded_plugins )
7576
7677 // user inputs the plugins to run
7778 a .plugins_to_run = a .GetPluginsFromUser ()
78- fmt .Println (a .plugins_to_run )
7979 } else {
8080 a .plugins_to_run = a .Settings .Riotpot .Start
8181 fmt .Printf ("\n Plugins to run are " )
@@ -91,7 +91,7 @@ func (a *Autopilot) Start() {
9191 running_mode_decision := a .CheckRunningMode ()
9292
9393 if running_mode_decision == "manual" {
94- fmt .Printf ("\n Docker containers available to run " )
94+ fmt .Printf ("\n Docker containers available to run are " )
9595 fmt .Println (a .loaded_containers )
9696 fmt .Printf ("\n " )
9797
@@ -116,12 +116,12 @@ func (a *Autopilot) Start() {
116116 // Hybrid mode
117117 running_mode_decision := a .CheckRunningMode ()
118118 if running_mode_decision == "manual" {
119- fmt .Printf ("\n Plugins available to run " )
119+ fmt .Printf ("\n Plugins available to run are " )
120120 fmt .Println (a .loaded_plugins )
121121 fmt .Printf ("\n " )
122122 a .plugins_to_run = a .GetPluginsFromUser ()
123123
124- fmt .Printf ("\n Docker containers available to run " )
124+ fmt .Printf ("\n Docker containers available to run are " )
125125 fmt .Println (a .loaded_containers )
126126 fmt .Printf ("\n " )
127127 a .containers_to_run = a .GetContainersFromUser ()
@@ -155,6 +155,8 @@ func (a *Autopilot) Start() {
155155 fmt .Printf ("\n Plugins to run are " )
156156 fmt .Println (a .plugins_to_run )
157157
158+ a .plugins_to_run = arrays .StringToArray (strings .ToLower (arrays .ArrayToString (a .plugins_to_run )))
159+
158160 if ! a .ValidatePlugin (a .plugins_to_run ) {
159161 log .Fatalf ("\n Please check the config file, and try again\n " )
160162 }
@@ -167,7 +169,7 @@ func (a *Autopilot) Start() {
167169 if ! a .ValidateContainers (a .containers_to_run ) {
168170 log .Fatalf ("\n Please check the config file, and try again\n " )
169171 }
170-
172+ a . containers_to_run = arrays . StringToArray ( strings . ToLower ( arrays . ArrayToString ( a . containers_to_run )))
171173 // glider forwards all the traffic on specific port to the respective service container
172174 a .DeployGlider ()
173175
@@ -181,10 +183,14 @@ func (a *Autopilot) Start() {
181183 if ! a .ValidatePlugin (a .plugins_to_run ) {
182184 log .Fatalf ("\n Please check the config file, and try again\n " )
183185 }
186+ a .plugins_to_run = arrays .StringToArray (strings .ToLower (arrays .ArrayToString (a .plugins_to_run )))
184187
185188 if ! a .ValidateContainers (a .containers_to_run ) {
186189 log .Fatalf ("\n Please check the config file, and try again\n " )
187190 }
191+
192+ a .containers_to_run = arrays .StringToArray (strings .ToLower (arrays .ArrayToString (a .containers_to_run )))
193+
188194 a .DeployGlider ()
189195 }
190196 }
@@ -251,7 +257,7 @@ func (a *Autopilot) RegisterPlugins() {
251257func (a * Autopilot ) DiscoverImages () {
252258 a .loaded_containers = a .Settings .GetDockerImages ()
253259 fmt .Printf ("[+] Found %d docker images \n " , len (a .loaded_containers ))
254- fmt .Printf ("[+] Allowed Docker images " )
260+ fmt .Printf ("[+] Available Docker images are " )
255261 fmt .Println (a .loaded_containers )
256262}
257263
@@ -364,12 +370,14 @@ func (a *Autopilot) CheckInteractionMode() (decision string) {
364370// Validates if the plugins to run matches the available plugins
365371// TODO: print all the invalid plugins not just the first one encountered
366372func (a * Autopilot ) ValidatePlugin (in_plugins []string ) (validated bool ){
367- if arrays .HasDuplicateItems (in_plugins ){
373+ if arrays .HaveDuplicateItems (in_plugins ){
368374 fmt .Printf ("\n [-] Entered plugins has duplicate entries, please enter again\n " )
369375 return false
370376 }
377+
371378 for _ , plugin := range in_plugins {
372- validated := arrays .Contains (a .loaded_plugins , strings .Title (strings .ToLower (plugin )))
379+ validated = arrays .Contains (a .loaded_plugins , plugin )
380+
373381 if ! validated {
374382 fmt .Printf ("\n [-] Entered plugin \" %s\" doesn't exist, please enter plugins again... \n " , plugin )
375383 return false
@@ -382,13 +390,13 @@ func (a *Autopilot) ValidatePlugin(in_plugins []string) (validated bool){
382390// Validates if the containers to run matches the loaded containers
383391// TODO: print all the invalid containers not just the first one encountered
384392func (a * Autopilot ) ValidateContainers (in_containers []string ) (validated bool ){
385- if arrays .HasDuplicateItems (in_containers ){
393+ if arrays .HaveDuplicateItems (in_containers ){
386394 fmt .Printf ("\n [-] Entered containers has duplicate entries, please enter again\n " )
387395 return false
388396 }
389397
390398 for _ , container := range in_containers {
391- validated := arrays .Contains ( a .loaded_containers , strings . ToLower ( container ) )
399+ validated := arrays .Contains ( a .loaded_containers , container )
392400 if ! validated {
393401 fmt .Printf ("\n [-] Entered container \" %s\" doesn't exist, please enter plugins again... \n " , container )
394402 return false
@@ -407,7 +415,7 @@ func (a *Autopilot) GetPluginsFromUser() (plugins []string) {
407415 for {
408416 fmt .Print ("Enter the plugins to run separated by space: " )
409417
410- input := a .ReadInput ()
418+ input := strings . ToLower ( a .ReadInput () )
411419 plugins = arrays .StringToArray (input )
412420
413421 validated := a .ValidatePlugin (plugins )
@@ -424,7 +432,7 @@ func (a *Autopilot) GetPluginsFromUser() (plugins []string) {
424432func (a * Autopilot ) GetContainersFromUser () (containers []string ) {
425433 for {
426434 fmt .Print ("Enter the containers to run separated by space: " )
427- input := a .ReadInput ()
435+ input := strings . ToLower ( a .ReadInput () )
428436 containers = arrays .StringToArray (input )
429437 validated := a .ValidateContainers (containers )
430438
@@ -439,7 +447,11 @@ func (a *Autopilot) GetContainersFromUser() (containers []string) {
439447
440448// Gives which plugins user wants to load in RIoTPot
441449func (a * Autopilot ) SetLoadedPlugins () {
442- a .loaded_plugins = a .services .GetServicesNames (a .services .GetServices ())
450+ if a .Settings .Riotpot .Local_build_on == "1" {
451+ a .loaded_plugins = a .services .GetServicesNames (a .services .GetServices ())
452+ } else {
453+ a .loaded_plugins = arrays .StringToArray (a .Settings .Riotpot .Boot_plugins )
454+ }
443455}
444456
445457// Validates if the given docker context exists and if it is set to default
0 commit comments