Maily debugging info to find reason nfsshare works but diskusage fails

This commit is contained in:
Brian Read 2024-09-13 16:36:57 +01:00
parent 436bc6d2f2
commit 20d5828803
7 changed files with 371 additions and 369 deletions

View File

@ -1,7 +1,7 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:46
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 at 2024-09-13 15:33
%#
<div id="DiskUsage-PARAMS" class="partial DiskUsage-PARAMS">
<div id="Diskusage-PARAMS" class="partial Diskusage-PARAMS">
<script>
window.onload = function() {
SelectInput();
@ -11,7 +11,7 @@
%= l('du Hello PARAMS');
</h2>
% my $btn = l('APPLY');
%= form_for "DiskUsaged" => (method => 'POST') => begin
%= form_for "Diskusaged" => (method => 'POST') => begin
% param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt}

View File

@ -1,9 +1,9 @@
% layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './';
%#
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 ( at 2024-09-12 19:46
%# Generated by SM2Gen version:0.8 Chameleon version:3.8.1 On Python:3.12.3 at 2024-09-13 15:33
%#
% content_for 'module' => begin
<div id="module" class="module DiskUsage-panel">
<div id="module" class="module Diskusage-panel">
% if ($config->{debug} == 1) {
<p>

View File

@ -1,48 +1,47 @@
{
'PackageName': 'DiskUsage',
'prefix': 'du',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'Disk Usage',
'MenuNavigation': '2000 400',
'firstPanel': 'PARAMS',
'signalEvent': 'smeserver-diskusage-update',
'html': [ {
'Name': 'params',
'route': 'PARAMS',
'Header': 'Disk usage',
'SubHeader': 'Manage DiskUsage settings:',
'Paragraph1': '&nbsp',
'Paragraph2': 'Wed Sep 11 19:01:00 BST 2024',
'Preformatted1': 'Filesystem Size Used Avail Use% Mounted on\n/dev/mapper/main-root 29G 4.8G 24G 17% /\ndevtmpfs 2.0G 0 2.0G 0% /dev\ntmpfs 2.0G 12K 2.0G 1% /dev/shm\ntmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup\ntmpfs 2.0G 648K 2.0G 1% /run\n/dev/sda1 497M 111M 386M 23% /boot',
'Table1': {
'Type': 'Table',
'TableControl': 'Table1',
'TopHeadings': [
PackageName: 'Diskusage',
prefix: 'du',
MenuHeading: 'Miscellaneous',
MenuDescription: 'Disk Usage',
MenuNavigation: '2000 400',
firstPanel: 'PARAMS',
signalEvent: 'smeserver-diskusage-update',
html: [{
Name: 'params',
route: 'PARAMS',
Header: 'Disk usage',
SubHeader: 'Manage DiskUsage settings:',
Paragraph1: '&nbsp',
Paragraph2: 'Wed Sep 11 19:01:00 BST 2024',
Preformatted1: 'Filesystem Size Used Avail Use% Mounted on\n/dev/mapper/main-root 29G 4.8G 24G 17% /\ndevtmpfs 2.0G 0 2.0G 0% /dev\ntmpfs 2.0G 12K 2.0G 1% /dev/shm\ntmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup\ntmpfs 2.0G 648K 2.0G 1% /run\n/dev/sda1 497M 111M 386M 23% /boot',
Table1: {
Type: 'Table',
TableControl: 'Table1',
TopHeadings: [
'I-bays',
'Usage',
'Path'
],
'Columns': [
Columns: [
'Table1-I-bays',
'Table1-Usage',
'Table1-Path'
]
},
'Paragraph3': '&nbsp',
'Table2': {
'Type': 'Table',
'TableControl': 'Table2',
'TopHeadings': [
Paragraph3: '&nbsp',
Table2: {
Type: 'Table',
TableControl: 'Table2',
TopHeadings: [
'Users',
'Usage',
'Path'
],
'Columns': [
Columns: [
'Table2-Users',
'Table2-Usage',
'Table2-Path'
]
}
}
]
}]
}

View File

@ -149,7 +149,7 @@ def insert_spaces_before_caps(text):
def save_to_json5(data, output_filename, package_name, header, sub_header):
"""Save extracted data to a JSON5 file with a specific structure."""
# Generate prefix from uppercase letters in PackageName made into lowercase
prefix = ''.join(re.findall(r'[A-Z]', package_name)).lowercase()
prefix = ''.join(re.findall(r'[A-Z]', package_name)).lower()
# Prepare structured html list
structured_html = []

View File

@ -309,10 +309,11 @@ if __name__ == "__main__":
except pkg_resources.DistributionNotFound:
chameleon_version = "Version information not available"
python_version = sys.version
python_version = python_version[:8]
version_pattern = r'(\d{1,3}\.\d{1,3}\.\d{1,3})'
version_match = re.search(version_pattern, python_version)
python_version = version_match.group(0) if version_match else 'Unknown'
current_datetime = datetime.now()
formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M")
strVersion = (
"SM2Gen version:"
+ SME2Gen_version
@ -414,9 +415,11 @@ if __name__ == "__main__":
get_table_control_data()
) # arrays of hashes used to drive rows in tables
# print(strVersion,tablecontrols,routes)
# Generate controller file
try:
controller_template = PageTemplateFile("Templates/controller.pm.tem")
controller_template = PageTemplateFile("Templates/controller.pm.tem",CHAMELEON_DEBUG="true")
dbentries = get_db_fields() # Params which correspond to Db fields
try:
controller_perl = controller_template.render(