Fixes for spaces in jail names

Description

My jails tab is empty and if i try to change jail location of open the plugin page i get the following error:

cannot open 'Server': dataset does not exist

more info...

Error: Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/iocage_lib/zfs.py", line 20, in run
cp.check_returncode()
File "/usr/local/lib/python3.7/subprocess.py", line 444, in check_returncode
self.stderr)
subprocess.CalledProcessError: Command '['zfs', 'get', '-H', '-o', 'property,value', 'all', 'Server']' 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.7/site-packages/middlewared/main.py", line 128, in call_method
result = await self.middleware.call_method(self, message)
File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1113, in call_method
return await self._call(message['method'], serviceobj, methodobj, params, app=app, io_thread=False)
File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1075, in _call
return await run_method(methodobj, *args)
File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 999, in _run_in_conn_threadpool
return await self.run_in_executor(self.__ws_threadpool, method, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 987, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/middlewared/schema.py", line 953, in nf
return f(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/jail.py", line 179, in query
resource_list = iocage.list('all', plugin=True, plugin_data=True)
File "/usr/local/lib/python3.7/site-packages/iocage_lib/iocage.py", line 1323, in list
**kwargs
File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_list.py", line 84, in list_datasets
_all = self.list_all(ds)
File "/usr/local/lib/python3.7/site-packages/iocage_lib/ioc_list.py", line 197, in list_all
mountpoint = jail.properties['mountpoint']
File "/usr/local/lib/python3.7/site-packages/iocage_lib/resource.py", line 23, in properties
self.resource_name, self.zfs_resource
File "/usr/local/lib/python3.7/site-packages/iocage_lib/zfs.py", line 54, in properties
resource_type, 'get', '-H', '-o', 'property,value', 'all', dataset
File "/usr/local/lib/python3.7/site-packages/iocage_lib/zfs.py", line 22, in run
raise ZFSException(cp.returncode, cp.stderr)
iocage_lib.zfs.ZFSException: cannot open 'Server': dataset does not exist

Problem/Justification

None

Impact

None

SmartDraw Connector

Katalon Manual Tests (BETA)

Activity

Show:

Waqar Ahmed December 27, 2019 at 11:54 AM

can you please clarify what you mean by corrupt jail ? From the steps you layed out, I am fairly sure that the sqlite one isn't needed, however for rest of them, those need to be done if you want to change the hostname as well which is accurate. iocage rename though handles them itself quite nicely. I have introduced some fixes to better accommodate spaces in jail names but we don't allow creation of new jails with spaces in their names now to make the flow simpler and not create any confusion.

Jared December 27, 2019 at 9:21 AM
Edited

one more note, this left me with a corrupt jail named PrintServer but all other jails functioned normally...

after taking a bit from 

https://www.ixsystems.com/community/threads/how-to-renaming-a-plugin-jail.21641/

i ended up needing to complete the following to fix the corrupt jail...

 

sqlite3 /data/freenas-v1.db
sqlite>update plugins_plugins set plugin_jail='PrintServer' where plugin_jail='Print Server';
sqlite>.q

Now, change the hostname in the following locations

:
nano ../iocage/jails/PrintServer/config.json

change line "host_hostname": "Print Server",

to                "host_hostname": "PrintServer",

change line "host_hostuuid": "Print Server",

to                "host_hostuuid": "PrintServer",

nano ../iocage/jails/PrintServer/root/etc/rc.conf

change line hostname="Print Server"

to                hostname="PrintServer"

nano ../iocage/jails/PrintServer/root/etc/hosts

 change line 127.0.0.1 localhost localhost.my.domain Print Server

 to                127.0.0.1 localhost localhost.my.domain PrintServer

Bug Clerk December 26, 2019 at 2:57 PM

Bug Clerk December 26, 2019 at 2:56 PM

Bug Clerk December 26, 2019 at 2:55 PM

Complete
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

More fields

Katalon Platform

Created December 24, 2019 at 9:23 AM
Updated July 1, 2022 at 4:46 PM
Resolved December 26, 2019 at 2:57 PM