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> <script>
window.onload = function() { window.onload = function() {
SelectInput(); SelectInput();
@ -11,7 +11,7 @@
%= l('du Hello PARAMS'); %= l('du Hello PARAMS');
</h2> </h2>
% my $btn = l('APPLY'); % my $btn = l('APPLY');
%= form_for "DiskUsaged" => (method => 'POST') => begin %= form_for "Diskusaged" => (method => 'POST') => begin
% param 'trt' => ${prefix}_data->{trt} unless param 'trt'; % param 'trt' => ${prefix}_data->{trt} unless param 'trt';
%= hidden_field 'trt' => ${prefix}_data->{trt} %= hidden_field 'trt' => ${prefix}_data->{trt}

View File

@ -1,9 +1,9 @@
% layout 'default', title => "Sme server 2 - Disk Usage", share_dir => './'; % 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 % content_for 'module' => begin
<div id="module" class="module DiskUsage-panel"> <div id="module" class="module Diskusage-panel">
% if ($config->{debug} == 1) { % if ($config->{debug} == 1) {
<p> <p>

View File

@ -1,48 +1,47 @@
{ {
'PackageName': 'DiskUsage', PackageName: 'Diskusage',
'prefix': 'du', prefix: 'du',
'MenuHeading': 'Miscellaneous', MenuHeading: 'Miscellaneous',
'MenuDescription': 'Disk Usage', MenuDescription: 'Disk Usage',
'MenuNavigation': '2000 400', MenuNavigation: '2000 400',
'firstPanel': 'PARAMS', firstPanel: 'PARAMS',
'signalEvent': 'smeserver-diskusage-update', signalEvent: 'smeserver-diskusage-update',
'html': [ { html: [{
'Name': 'params', Name: 'params',
'route': 'PARAMS', route: 'PARAMS',
'Header': 'Disk usage', Header: 'Disk usage',
'SubHeader': 'Manage DiskUsage settings:', SubHeader: 'Manage DiskUsage settings:',
'Paragraph1': '&nbsp', Paragraph1: '&nbsp',
'Paragraph2': 'Wed Sep 11 19:01:00 BST 2024', 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', 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': { Table1: {
'Type': 'Table', Type: 'Table',
'TableControl': 'Table1', TableControl: 'Table1',
'TopHeadings': [ TopHeadings: [
'I-bays', 'I-bays',
'Usage', 'Usage',
'Path' 'Path'
], ],
'Columns': [ Columns: [
'Table1-I-bays', 'Table1-I-bays',
'Table1-Usage', 'Table1-Usage',
'Table1-Path' 'Table1-Path'
] ]
}, },
'Paragraph3': '&nbsp', Paragraph3: '&nbsp',
'Table2': { Table2: {
'Type': 'Table', Type: 'Table',
'TableControl': 'Table2', TableControl: 'Table2',
'TopHeadings': [ TopHeadings: [
'Users', 'Users',
'Usage', 'Usage',
'Path' 'Path'
], ],
'Columns': [ Columns: [
'Table2-Users', 'Table2-Users',
'Table2-Usage', 'Table2-Usage',
'Table2-Path' '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): def save_to_json5(data, output_filename, package_name, header, sub_header):
"""Save extracted data to a JSON5 file with a specific structure.""" """Save extracted data to a JSON5 file with a specific structure."""
# Generate prefix from uppercase letters in PackageName made into lowercase # 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 # Prepare structured html list
structured_html = [] structured_html = []

View File

@ -309,10 +309,11 @@ if __name__ == "__main__":
except pkg_resources.DistributionNotFound: except pkg_resources.DistributionNotFound:
chameleon_version = "Version information not available" chameleon_version = "Version information not available"
python_version = sys.version 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() current_datetime = datetime.now()
formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M") formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M")
strVersion = ( strVersion = (
"SM2Gen version:" "SM2Gen version:"
+ SME2Gen_version + SME2Gen_version
@ -414,9 +415,11 @@ if __name__ == "__main__":
get_table_control_data() get_table_control_data()
) # arrays of hashes used to drive rows in tables ) # arrays of hashes used to drive rows in tables
# print(strVersion,tablecontrols,routes)
# Generate controller file # Generate controller file
try: 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 dbentries = get_db_fields() # Params which correspond to Db fields
try: try:
controller_perl = controller_template.render( controller_perl = controller_template.render(