Labtainers icon indicating copy to clipboard operation
Labtainers copied to clipboard

Type error in ParseStartConfig.py

Open Blutsh opened this issue 2 years ago • 1 comments

Description

When rebuilding / launching a multi-user conformant lab using the -n options, you get an TypeError which prevents you to run / build the lab.

Expected behavior

Create and launch n instances of CLIENT containers.

Actual behavior

When building / launching a conformant multi-user labs using either :

rebuild myLab -n 3

or:

Labtainer myLab -n 3 

I Get the following error :

Traceback (most recent call last):
  File "bin/start.py", line 289, in <module>
    sys.exit(main())
  File "bin/start.py", line 276, in main
    labutils.StartLab(lab_path, quiet_start=args.quiet, run_container=args.only_container, servers=distributed, clone_count=args.client_count)
  File "/home/student/labtainer/trunk/scripts/labtainer-student/bin/labutils.py", line 2023, in StartLab
    labtainer_config, start_config = GetBothConfigs(lab_path, logger, servers, clone_count)
  File "/home/student/labtainer/trunk/scripts/labtainer-student/bin/labutils.py", line 1194, in GetBothConfigs
    labtainer_config, logger, servers=servers, clone_count=clone_count)
  File "/home/student/labtainer/trunk/scripts/labtainer-student/bin/ParseStartConfig.py", line 81, in __init__
    if self.clone_count is not None and self.clone_count > 0: 
TypeError: '>' not supported between instances of 'str' and 'int'

Reproducible example

  1. create a conformant multi-user lab (MACVLAN 1, +CLONE_COUNT)
  2. run either rebuild command or labtainer using the dash n option

Quick fix / workaround

I just casted to int the arg : /home/student/labtainer/trunk/scripts/labtainer-student/bin/ParseStartConfig.py (around line 78)


 self.get_configs(fname)
        self.multi_user = None
        ''' determine if running as a distributed Labtainers, or many clients on a single VM '''
        if self.clone_count is not None and int(self.clone_count) > 0: 
            self.multi_user = 'clones'
        elif servers is not None:
            self.multi_user = servers 
        self.finalize()
        self.validate()
        self.logger.debug('Completed reload from %s' % fname)

Blutsh avatar May 11 '23 08:05 Blutsh

Thanks for the report and the details on the workaround. I'll get that fix into the pipeline.

mfthomps avatar May 22 '23 01:05 mfthomps