Skip to content

Add CompatForm based version of ConfigForm#5480

Open
TheSyscall wants to merge 8 commits intomainfrom
config-form-5479
Open

Add CompatForm based version of ConfigForm#5480
TheSyscall wants to merge 8 commits intomainfrom
config-form-5479

Conversation

@TheSyscall
Copy link
Copy Markdown

@TheSyscall TheSyscall commented Mar 23, 2026

An implementation of an INI based configuration form for CompatForms.

It allows developers to create a configuration form for an INI file and have it automatically populate form elements and store the results back into the specified file or section.

If writing the configuration file fails, an error is displayed alongside the full contents of the file to copy and paste manually by the admin.

This form can optionally be used to delete a section of the configuration file or create a new one.

As suggested here

resolves #5479

@TheSyscall TheSyscall self-assigned this Mar 23, 2026
@cla-bot cla-bot Bot added the cla/signed label Mar 23, 2026
TheSyscall added a commit to Icinga/icingaweb2-module-pdfexport that referenced this pull request Mar 23, 2026
@TheSyscall TheSyscall requested a review from Al2Klimov March 25, 2026 12:00
Copy link
Copy Markdown
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test

  1. Install Fedora 42
  2. Apply https://github.com/Al2Klimov/ansible-icinga-fedora
  3. yum remove icingaweb2-module-monitoring
  4. Downgrade to https://git.icinga.com/packages/icingaweb/-/jobs/856109
  5. tar -C /usr/share/icingaweb2/modules -vxzf ~fedora/test5480.tgz
  6. icingacli mod en test5480
  7. Visit /icingaweb2/test5480
  8. Input something
  9. Press enter
  10. cat /etc/icingaweb2/modules/test5480/config.ini
  11. Ok
  12. chmod 0440 /etc/icingaweb2/modules/test5480/config.ini
  13. Repeat steps 7-9
  14. Fails

Seems to work. So far – so good.

test5480.tgz

Comment thread library/Icinga/Web/Widget/ShowConfiguration.php Outdated
Comment thread library/Icinga/Web/Form/ConfigForm.php Outdated
Comment thread library/Icinga/Web/Widget/ShowConfiguration.php
Comment thread library/Icinga/Web/Widget/ShowConfiguration.php
Comment thread library/Icinga/Web/Form/ConfigForm.php Outdated
Comment thread library/Icinga/Web/Form/ConfigForm.php
Comment thread library/Icinga/Web/Form/ConfigForm.php Outdated
$value = $this->getConfigValue($element->getName());

$configSection = $this->config->getSection($section);
if (empty($value)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

php -r 'echo (int) empty("0");' says "1", so empty() seems not the best idea, does it?

Copy link
Copy Markdown
Author

@TheSyscall TheSyscall Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no problems with storing "0" values in the configuration.
Since it could be any type of element here, I don't think there is a reliable way determine if the field should be included or not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, your empty() doesn't store "0" values. Is this intentional?

Comment thread library/Icinga/Web/Form/ConfigForm.php Outdated
TheSyscall added a commit to Icinga/icingaweb2-module-pdfexport that referenced this pull request Apr 7, 2026
@TheSyscall TheSyscall requested a review from Al2Klimov April 16, 2026 11:40
@Al2Klimov Al2Klimov requested a review from flourish86 April 16, 2026 15:07
@Al2Klimov Al2Klimov removed their request for review April 28, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an ipl\Compat\Form version of ConfigForm

3 participants