mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
acrn-config: fix the issue config app failed to generate patch for a new board
fix the issue: WebUI could not generate configuration patch for a new imported board Tracked-On: #3760 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
bdf3a89e6d
commit
4f9c2f3a7a
@ -253,10 +253,11 @@ class XmlConfig:
|
||||
|
||||
raise Exception('can not find node by {} from xml'.format(args))
|
||||
|
||||
def save(self, xml=None):
|
||||
def save(self, xml=None, user_defined=True):
|
||||
"""
|
||||
save current xml to file.
|
||||
:param xml: the file name to save; if not specified, save current xml to default names.
|
||||
:param user_defined: save to user defined folder or default folder.
|
||||
:return: None.
|
||||
"""
|
||||
if self._curr_xml_tree is None:
|
||||
@ -264,6 +265,8 @@ class XmlConfig:
|
||||
if xml is None:
|
||||
xml = self._curr_xml
|
||||
|
||||
xml_path = self._xml_path
|
||||
if user_defined:
|
||||
xml_path = os.path.join(self._xml_path, 'user_defined')
|
||||
if not os.path.isdir(xml_path):
|
||||
os.makedirs(xml_path)
|
||||
|
@ -452,7 +452,13 @@ def upload_board_info():
|
||||
for generic_name in os.listdir(os.path.join(config_path, 'generic')):
|
||||
generic_file = os.path.join(config_path, 'generic', generic_name)
|
||||
if os.path.isfile(generic_file):
|
||||
copyfile(generic_file, os.path.join(config_path, board_type, generic_name))
|
||||
new_file = os.path.join(config_path, board_type, generic_name)
|
||||
copyfile(generic_file, new_file)
|
||||
xml_config = XmlConfig(os.path.join(current_app.config.get('CONFIG_PATH'),
|
||||
board_type))
|
||||
xml_config.set_curr(generic_name[:-4])
|
||||
xml_config.set_curr_attr('board', board_type)
|
||||
xml_config.save(generic_name[:-4], user_defined=False)
|
||||
|
||||
board_info = os.path.splitext(file.filename)[0]
|
||||
current_app.config.update(BOARD_INFO=board_info)
|
||||
|
Loading…
Reference in New Issue
Block a user