Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-102183

Provide validation for jailname in middleware

    XMLWordPrintable

    Details

      Description

      The system generates a Traceback when I try to create a jail that contains invalid characters.

      When attempting to do this through the CLI, iocage handles this correctly:

      iocage create -n foo+bar -r 11.2-RELEASE
      Invalid character in foo+bar, please remove it.
      

      However, trying to create a jail name foo+bar crashes with the Traceback below.  The main message states "RELEASE: 11.2-RELEASE not found!"

      Error: concurrent.futures.process._RemoteTraceback: 
      """
      Traceback (most recent call last):
        File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_create.py", line 267, in _create_jail
          f"root@{jail_uuid}"], stderr=su.PIPE)
        File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['zfs', 'snapshot', 'tank/iocage/releases/11.2-RELEASE/root@foo+bar']' returned non-zero exit status 1.During handling of the above exception, another exception occurred:Traceback (most recent call last):
        File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_create.py", line 270, in _create_jail
          snapshot = self.zfs.get_snapshot(dataset)
        File "libzfs.pyx", line 609, in libzfs.ZFS.get_snapshot
      libzfs.ZFSException: Snapshot tank/iocage/releases/11.2-RELEASE/root@foo+bar not foundDuring handling of the above exception, another exception occurred:Traceback (most recent call last):
        File "/usr/local/lib/python3.6/concurrent/futures/process.py", line 175, in _process_worker
          r = call_item.fn(*call_item.args, **call_item.kwargs)
        File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 128, in main_worker
          res = loop.run_until_complete(coro)
        File "/usr/local/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
          return future.result()
        File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 88, in _run
          return await self._call(f'{service_name}.{method}', serviceobj, methodobj, params=args, job=job)
        File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 81, in _call
          return methodobj(*params)
        File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 81, in _call
          return methodobj(*params)
        File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/jail.py", line 200, in create_job
          empty=empty
        File "/usr/local/lib/python3.6/site-packages/iocage_lib/iocage.py", line 611, in create
          clone=clone,
        File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_create.py", line 87, in create_jail
          return self._create_jail(jail_uuid, location)
        File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_create.py", line 283, in _create_jail
          f"RELEASE: {self.release} not found!")
      RuntimeError: RELEASE: 11.2-RELEASE not found!
      """The above exception was the direct cause of the following exception:Traceback (most recent call last):
        File "/usr/local/lib/python3.6/site-packages/middlewared/job.py", line 332, in run
          await self.future
        File "/usr/local/lib/python3.6/site-packages/middlewared/job.py", line 356, in __run_body
          rv = await self.middleware._call_worker(self.serviceobj, self.method_name, *self.args, job={'id': self.id})
        File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1105, in _call_worker
          job,
        File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1036, in run_in_proc
          return await self.run_in_executor(self.__procpool, method, *args, **kwargs)
        File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1021, in run_in_executor
          return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
      RuntimeError: RELEASE: 11.2-RELEASE not found!
      
      
      

        Attachments

          Attachments

            JEditor

              Issue Links

                Activity

                  People

                  Assignee:
                  brandon Brandon Schneider (Inactive)
                  Reporter:
                  lola Lola Yang (Inactive)
                  Watchers:
                  Bug Clerk, Lola Yang (Inactive)
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved: