Project

General

Profile

Bug #54861

Add ability to iocage to use defaults when existing configuration file is corrupt

Added by Rolandas S over 1 year ago. Updated over 1 year ago.

Status:
Done
Priority:
No priority
Assignee:
Brandon Schneider
Category:
Middleware
Target version:
Seen in:
Severity:
Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No
Tags:

Description

Creating new jail ib GUI (the same via CLI) fails with errors below:

FAILED
local variable 'default_props' referenced before assignment

Error: concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_json.py", line 1684, in json_check_default_config
default_props = json.load(default_json)
File "/usr/local/lib/python3.6/json/__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During 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 122, 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 82, in _run
return await self._call(f'{service_name}.{methodserviceobj, methodobj, params=args, job=job)
File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 75, in _call
return methodobj(*params)
File "/usr/local/lib/python3.6/site-packages/middlewared/worker.py", line 75, in _call
return methodobj(*params)
File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/jail.py", line 182, 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 193, in _create_jail
config = self.create_config(jail_uuid, cloned_release)
File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_create.py", line 517, in create_config
jail_props = ioc_json.json_check_default_config()
File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_json.py", line 1802, in json_check_default_config
self.json_write(default_props, default_json_location)
UnboundLocalError: local variable 'default_props' referenced before assignment
"""

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 1007, in _call_worker
job,
File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 938, 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 923, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
UnboundLocalError: local variable 'default_props' referenced before assignment

iocage-defaults-corrupt-or-missing.png (52.7 KB) iocage-defaults-corrupt-or-missing.png Timothy Moore II, 11/12/2018 11:25 AM
40165

History

#1 Updated by Dru Lavigne over 1 year ago

  • Category changed from GUI (new) to Middleware
  • Assignee changed from Release Council to William Grzybowski
  • Private changed from No to Yes
  • Reason for Blocked set to Need additional information from Author

Rolandas: please attach a debug (System -> Advanced -> Save debug) to this ticket.

#2 Updated by Rolandas S over 1 year ago

  • File debug.tgz added

Debug file attached. Thanks.

#3 Updated by Dru Lavigne over 1 year ago

  • Reason for Blocked deleted (Need additional information from Author)

#4 Updated by William Grzybowski over 1 year ago

  • Assignee changed from William Grzybowski to Brandon Schneider

#5 Updated by Dru Lavigne over 1 year ago

  • Target version changed from Backlog to 11.2-RC2

#6 Updated by Brandon Schneider over 1 year ago

  • Status changed from Unscreened to In Progress
  • Seen in set to 11.2-RC1
  • Severity changed from New to Medium

#7 Updated by Dru Lavigne over 1 year ago

  • File deleted (debug.tgz)

#8 Updated by Dru Lavigne over 1 year ago

  • Subject changed from New jail creation fails to Add ability to iocage to use defaults when existing configuration file is corrupt
  • Private changed from Yes to No

#9 Updated by William Grzybowski over 1 year ago

  • Status changed from In Progress to Ready for Testing

#10 Updated by Dru Lavigne over 1 year ago

  • Needs Merging changed from Yes to No

#12 Updated by Timothy Moore II over 1 year ago

  • Needs Doc changed from Yes to No

#14 Updated by Timothy Moore II over 1 year ago

40165

Testing with FreeNAS Mini updated to INTERNAL46:

- Go to the Shell.
- Open location of iocage defaults.json file and delete random characters. Save the file.
- enter "iocage create r 11.2-RELEASE -n test14". Shell returns "Defaults are corrupt, using iocage defaults in memory" and "test14 successfully created!"
Go back and remove the defaults.json file.
- Enter "iocage create -r 11.2-RELEASE -n test15". Shell returns "Default configuration missing, creating one" and "test15 successfully created!"

#15 Updated by Dru Lavigne over 1 year ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF