Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
aa4a3a5
Add database migration for DirectorProperty and custom variable support
raviks789 May 29, 2026
e87134f
Add model support for new custom variable
raviks789 May 29, 2026
9e24d14
Add forms, controllers, and REST API handler for custom variable mana…
raviks789 May 29, 2026
695075a
Add basket import/export support for custom variables
raviks789 May 29, 2026
0366d5a
Add CLI commands for custom variable management
raviks789 May 29, 2026
d5aaa50
Add test suite and documentation for custom variable and dictionary s…
raviks789 May 29, 2026
669a656
CustomVariablesForm: Allow saving empty items for dynamic dictionaries
raviks789 Jun 2, 2026
225cde8
IcingaService: Whitelist 'key' for apply-for rule
raviks789 Jun 2, 2026
7c39d28
ObjectController: Modify apply for header to support accessing of keys
raviks789 Jun 2, 2026
b83233d
Add confirmation feature for renaming a custom variable
raviks789 Jun 8, 2026
56230e4
CustomvarController: Remove the unnecessary autorefreshInterval settings
raviks789 Jun 16, 2026
8fe6a4b
CustomVariableForm: Use Callout to warn renaming of used custom varia…
raviks789 Jun 16, 2026
773de3e
IcingaServiceForm: Support apply for rules for datafields of type arr…
raviks789 Jun 16, 2026
a30caaa
CustomVariablesForm: Unset empty dynamic dictionary from the object
raviks789 Jun 16, 2026
419ed6f
Use checkbox element for rename confirmation
raviks789 Jun 17, 2026
d62a332
Change overridenVar to overriddenVar
raviks789 Jun 24, 2026
3c2d305
Change overridenVar to overriddenVar in tests
raviks789 Jun 24, 2026
4a835fa
IcingaObjectFieldLoader: Restore getNameMap() method
raviks789 Jun 25, 2026
8dd3efe
IcingaMultiEditForm: Show deprecated custom properties on multi-select
raviks789 Jun 25, 2026
1a2484c
Fix value type conflict of linked data fields and custom variables wi…
raviks789 Jun 25, 2026
5e4d250
IcingaServiceForm: Fix label (key) mapping for apply for custom vars
raviks789 Jun 25, 2026
1790206
CustomVarRenderer: Fix order by for custom var types of new custom va…
raviks789 Jun 25, 2026
bedeae1
CustomvarController: Prevent recreating of UuidInterface for parentuuid
raviks789 Jun 25, 2026
9a36e32
CustomVariableForm: Allow value type change only when the custom var …
raviks789 Jun 25, 2026
8f42eb8
CustomVariableForm: Fix incorrect use of Dbquery::where()
raviks789 Jun 25, 2026
900064a
DeleteCustomVariableForm: Delete link to objects and then remove cust…
raviks789 Jun 25, 2026
3e13bf9
Add foreign key constraints to icinga_*_var tables
raviks789 Jun 25, 2026
a083015
IcingaObjectHandler: Fix null dereference for the services when the a…
raviks789 Jun 30, 2026
b237453
HostController: Fix type mismatch of argument given to CustomVariable…
raviks789 Jun 30, 2026
0bf2dc8
IcingaObjectHandler: Wrap PUT DELETE in a db transaction
raviks789 Jun 30, 2026
b3ae826
CustomVariableForm: Fix incorrect early return while renaming of root…
raviks789 Jun 30, 2026
e8469ae
DictionaryItem: Add match arms to handle incorrect value assignment o…
raviks789 Jun 30, 2026
bb4a069
CustomVariables: Use batch property lookup for custom variables
raviks789 Jun 30, 2026
2064e81
DataController: Remove IcingaHostDictionaryMemberForm usage
raviks789 Jul 1, 2026
a855388
IcingaServiceForm: Remove unused usages
raviks789 Jul 1, 2026
54c90f7
Update relevant documentations
raviks789 Jul 1, 2026
0249d9f
Remove New-Custom-Property-Implementation.md
raviks789 Jul 1, 2026
f4cdd3e
Mysql schema: Restructure and change uuids from binary to varbinary
raviks789 Jul 2, 2026
7a3bc20
mysql.sql: Change charset to utf8mb4 for director_property and icinga…
raviks789 Jul 2, 2026
6f745e0
DirectorProperty: Safely unset parent_uuid_v for mysql database
raviks789 Jul 2, 2026
8bfff3f
DbObject: Check if the property $autoincKeyName before accessing it
raviks789 Jul 2, 2026
d81b0ef
DeleteCustomVariableForm: Delete datalist links and properties for al…
raviks789 Jul 3, 2026
41952a8
CustomVariableFormi: Delete datalist links and properties for all des…
raviks789 Jul 3, 2026
44f709a
director_property_datalist table must allow only one link per directo…
raviks789 Jul 3, 2026
c7dca53
Add admin permission for editing the custom variables
raviks789 Jul 5, 2026
f5c2811
IcingaObjectHandler: Fix referencing null `$object` property
raviks789 Jul 6, 2026
868cc79
doc/70-REST-API.md: Fix the documentation
raviks789 Jul 6, 2026
1e32e18
Apply-for configuration: Provide backward compatibility for renaming …
raviks789 Jul 6, 2026
d02bae9
IcingaService: Fix fetchItemsForDictionary() for postgres
raviks789 Jul 6, 2026
3e877aa
CustomVariableForm: Fix static analysis errors
raviks789 Jul 6, 2026
aeda63f
DirectorProperty: Resolve datalist during property import
raviks789 Jul 6, 2026
6d8d8ad
IcingaService: escape embedded quotes using IcingaConfigHelper::rende…
raviks789 Jul 6, 2026
5509375
schema Mysql: Add ON UPDATE CASCADE to director_property_list_propert…
raviks789 Jul 6, 2026
b310356
DirectorPropertyTest: Add regression tests for dynamic-dictionary dat…
raviks789 Jul 6, 2026
488bb23
Add CustomVariableValueValidator to check REST API variable values ag…
raviks789 Jul 7, 2026
729573f
Add CustomVariableValueApplier with an atomic transaction and value v…
raviks789 Jul 7, 2026
a6b264d
IcingaObjectHandler: Delegate variable overrides to CustomVariableVal…
raviks789 Jul 7, 2026
af39075
CustomVariablesForm: Allow attaching a new custom variable only for t…
raviks789 Jul 7, 2026
b8b994e
BasketSnapshotCustomVariableResolver: Enforce storeNewProperties() be…
raviks789 Jul 7, 2026
07d8a2a
module.js: Fix highlightActiveDashlet always returning before highlig…
raviks789 Jul 7, 2026
2912272
DictionaryItem: Fix nested dictionary label placement and missing ite…
raviks789 Jul 7, 2026
8933fbf
CustomVariablesForm: Stop treating 0, 0.0 and the string 0 as unset
raviks789 Jul 7, 2026
9839333
ObjectController: Show every nested key in the apply for hint table, …
raviks789 Jul 7, 2026
0e21c40
Dictionary, NestedDictionary: Remove dead item removal bookkeeping
raviks789 Jul 7, 2026
4aa35a4
CustomVariablesForm: Fail fast when a service variable override has n…
raviks789 Jul 7, 2026
8d0970c
ObjectController: Provide a better note for accessing dictionary valu…
raviks789 Jul 7, 2026
e3b4de7
DirectorProperty: Fetch the datalist linked to the property before de…
raviks789 Jul 8, 2026
494f06e
DirectorPropertyi: Load :datalist only if it is present in DB
raviks789 Jul 8, 2026
1b37798
MigrateCommand: Link datalist after migrating datafield to new custom…
raviks789 Jul 8, 2026
a517653
CustomVariableForm: Allow dynamic-array as grand child for dynamic di…
raviks789 Jul 8, 2026
ea2e02b
DeleteCustomVariableForm: Relink datalist after updating item order f…
raviks789 Jul 8, 2026
b09289b
ObjectTabs: Custom Variables tab should appear before Fields tab
raviks789 Jul 8, 2026
51b278b
DeleteCustomVariableForm: Fix reindexing of items for fixed-array on …
raviks789 Jul 8, 2026
8e3f09c
Db: Roll back runFailSafeTransaction() on any Throwable, not just Exc…
raviks789 Jul 8, 2026
63cf1d7
CustomvarController: Close the modal if the property was already deleted
raviks789 Jul 8, 2026
d899e60
DeleteCustomVariableForm: Fix crash when deleting an item from a root…
raviks789 Jul 8, 2026
5d5b039
DeleteCustomVariableForm: Reindex fixed-array items numerically, not …
raviks789 Jul 8, 2026
164d705
DeleteCustomVariableForm: Roll back the deletion if it fails partway …
raviks789 Jul 8, 2026
c6fd077
DeleteCustomVariableForm: Resolve the actual root property for deeply…
raviks789 Jul 8, 2026
54facc0
DeleteCustomVariableForm: Fix dynamic-dictionary entries not losing a…
raviks789 Jul 8, 2026
cf372d0
DeleteCustomVariableForm: Renumber fixed-array items in place instead…
raviks789 Jul 8, 2026
ddfe8ec
CustomVariablesForm: Fix saving of fixed-array type custom variables
raviks789 Jul 9, 2026
84447d3
CustomVariablesForm: Remove unnecessary use of DbUtil::quoteBinaryCom…
raviks789 Jul 9, 2026
6c7d111
DictionaryItem: Sort fixed-array items by there key_name (numerically)
raviks789 Jul 9, 2026
24b2150
MigrateCommand: Skip unsupported datafield types even without verbose…
raviks789 Jul 9, 2026
a11d17b
MigrateCommand: Roll back the datafield migration loop on failure
raviks789 Jul 9, 2026
2ff9de5
MigrateCommand: Only record a datafield as migrated when it was actua…
raviks789 Jul 9, 2026
8159e29
MigrateCommand: Avoid unnecessarily loading all objects
raviks789 Jul 9, 2026
969ad06
Fix possible schema drift on director_datalist's UNIQUE KEY
raviks789 Jul 9, 2026
5eba7b0
Index property_uuid for icinga_{object}_property
raviks789 Jul 9, 2026
a3d0d6f
mysql.sql: Fix column order mismatch for director_property with upgra…
raviks789 Jul 9, 2026
3880fad
DirectorProperty: Introduce stripVirtualParentUuidColumn() method to …
raviks789 Jul 9, 2026
4523018
MigrateCommand: Take the fields is_required and var_filter into scope…
raviks789 Jul 9, 2026
87582b2
IcingaObjectHandler: Require a resolved object for the variables REST…
raviks789 Jul 9, 2026
365e8af
DirectorProperty: Fix fatal error in import() when a property's paren…
raviks789 Jul 9, 2026
a164440
CustomVariableForm: Roll back the transaction in onSuccess() on failure
raviks789 Jul 9, 2026
a5a4d3b
CustomVariablesForm: Stop filterEmpty() from dropping 0, '0' and 0.0 …
raviks789 Jul 9, 2026
5d38119
NestedDictionaryItem: Preserve falsy 0/false/'0' values when re-displ…
raviks789 Jul 9, 2026
767c0ac
MigrateCommand: Default a datalist datafield's missing 'behavior' set…
raviks789 Jul 9, 2026
f796fce
CustomVariableDictionary: Sort keys before serializing getValue()
raviks789 Jul 10, 2026
cff890c
MigrateCommand: Don't count unsupported-type datafields as migrated
raviks789 Jul 10, 2026
b4a5dc4
CustomVariables: Make the dynamic-dictionary merge cache deterministic
raviks789 Jul 10, 2026
abc71dc
CustomVarRenderer: Fix crash on scalar fields inside dictionaries
raviks789 Jul 13, 2026
7431fc6
CustomVarRenderer: Mask sensitive properties in the read view
raviks789 Jul 13, 2026
75adc7d
CustomVariables: Add a 'sensitive' value type
raviks789 Jul 13, 2026
391956a
MigrateCommand: Migrate hidden-visibility strings as 'sensitive'
raviks789 Jul 13, 2026
adf4b44
DictionaryItem: Render 'sensitive' fields with a masked value widget
raviks789 Jul 13, 2026
1955675
doc: Document the sensitive custom variable type
raviks789 Jul 13, 2026
518912a
Tests: Merge redundant sensitive-prepare test, fix blank line in Migr…
raviks789 Jul 13, 2026
a3ec1c2
DictionaryItem: Wrap long fetchChildrenItems signature
raviks789 Jul 13, 2026
be4bd55
DictionaryItem: Tidy up key order sorting comment for fixed-array
raviks789 Jul 13, 2026
c1206fe
test: Clean up tests
raviks789 Jul 13, 2026
d802e4e
DirectorProperty: Dynamic-dictionary type custom variables must not b…
raviks789 Jul 13, 2026
bbfca13
DictionaryItem: Preserve sensitive values in nested and dynamic dicti…
raviks789 Jul 13, 2026
f2fcca2
tests: resolve static analysis error in DictionaryItemTest due to req…
raviks789 Jul 14, 2026
0a070ad
DictionaryItem: Resolve saving null to fixed-array items for string i…
raviks789 Jul 14, 2026
42dd807
DictionaryItemTest: remove tests trying to connect to a non-existent …
raviks789 Jul 14, 2026
0c42a5f
DictionaryItem: Extract db adapter resolution into getDb()
raviks789 Jul 14, 2026
6ef0030
DictionaryItemTest: Restore db-backed coverage and add mergeChildValu…
raviks789 Jul 14, 2026
fe4a45b
MigrateCommandTest: Remove redundant tests
raviks789 Jul 14, 2026
1daa5d3
HostsCommand: Fix overwriting of $type variable
raviks789 Jul 14, 2026
4948a09
CustomVarRenderer: Cleanup getObjectCustomProperties() method
raviks789 Jul 14, 2026
2efa157
CustomVarRenderer: Fix custom var renderer for complex customvar stru…
raviks789 Jul 14, 2026
a948585
ObjectController: Remove trailing space after 'key_name'
raviks789 Jul 14, 2026
448101d
HostsCommand: Fix getObjectCustomVariables() for Postgres
raviks789 Jul 14, 2026
d6b5fa7
ObjectController: Fix uuid in $propertyData for Postgres in sendNewVa…
raviks789 Jul 14, 2026
251b37a
DirectorProperty: Move NON_NESTABLE_TYPES constant above method and p…
raviks789 Jul 15, 2026
9fad428
MigrateCommand: Add summary action to avoid implicit datafields migra…
raviks789 Jul 15, 2026
9f90e59
MigrateCommand: Clean up confusing datafield migration summary
raviks789 Jul 15, 2026
5bc91b7
MigrateCommandTest: Add VAR_ENV_CHOICES_DEFAULT_BEHAVIOR to MIGRATABL…
raviks789 Jul 15, 2026
7b5caaa
DirectorPropertyTest: Remove mentions of regression tests in PHPDoc b…
raviks789 Jul 15, 2026
30e3683
CustomVariableForm: Show 'List Name' as required
raviks789 Jul 15, 2026
8095680
DeleteCustomVariableForm: Move array_merge outside the loop in collec…
raviks789 Jul 15, 2026
5062b12
CustomVariablesForm: Use LogicException instead of deprecated Program…
raviks789 Jul 15, 2026
9634aaf
HostController: Add submit handler to forms overriding service variables
raviks789 Jul 15, 2026
487baf4
CustomVariablesForm: Resolve incorrect arguments passed to LogicExcep…
raviks789 Jul 15, 2026
9350b1b
HostController: Redirect on submitting the CustomVariablesForm
raviks789 Jul 15, 2026
80d5ef5
ObjectController: Do not show inherited values for overridden service…
raviks789 Jul 15, 2026
da192e5
CustomVariablesForm: Correctly update overridden service variables
raviks789 Jul 15, 2026
3d88dd5
CustomVariablesForm: Log only if there are any modifications in the v…
raviks789 Jul 15, 2026
a0606c4
CustomVariablesTest: Remove redundant tests
raviks789 Jul 16, 2026
1ee83a4
CustomVariables: Use table alias consistently for all columns
raviks789 Jul 16, 2026
a3af3eb
CustomvarController: Remove calling Uuid::fromString() on UuidInterface
raviks789 Jul 16, 2026
b0fec61
module.less: Wrap overflowing apply-for key=>value table with horizon…
raviks789 Jul 16, 2026
cee1f0c
IcingaService: Prefer legacy Data field over colliding Custom Variabl…
raviks789 Jul 16, 2026
88e501b
CustomVarRenderer: Add all queried columns to group by in getObjectCu…
raviks789 Jul 16, 2026
8efae9d
CustomVariableReferenceLoader:Export 'required' flag in Basket
raviks789 Jul 16, 2026
9dfa289
IcingaConfigHelper: Bound wildcard whitelist matches to safe characte…
raviks789 Jul 16, 2026
c3e9105
RestApi: Make custom-variable application transaction-aware and scope…
raviks789 Jul 16, 2026
3963d54
DictionaryItem: Stop erasing an unchanged sensitive value of "0"
raviks789 Jul 16, 2026
63eabb1
CustomVarRenderer: Scope dictionary child label and visibility by parent
raviks789 Jul 16, 2026
33d5491
CustomVarRenderer: Quote binary UUIDs before use in the metadata IN c…
raviks789 Jul 16, 2026
a32cec1
ObjectController: Custom variables with space should be accessible by…
raviks789 Jul 16, 2026
b0cdd01
IcingaConfigHelper: Allow quoted dictionary keys in wildcard macro ch…
raviks789 Jul 16, 2026
1883c35
IcingaConfigHelperTest: Use real-world plugin and macro examples
raviks789 Jul 16, 2026
9d9add3
CI: Clone icingadb-web module for PHPUnit run
raviks789 Jul 16, 2026
3618db8
IcingaServiceApplyForTest: Update test to match current whitelist sco…
raviks789 Jul 16, 2026
233cb93
RestApi: Collapse long parameter lists into request value objects
raviks789 Jul 16, 2026
8f76e47
IcingaServiceApplyForTest: Attach disk_checks_macro property to a host
raviks789 Jul 16, 2026
8c38f89
IcingaServiceApplyForTest: Resolve php cs errorst
raviks789 Jul 16, 2026
6fc9de6
CustomVariableForm: Relink datalist when only the selected list changes
raviks789 Jul 17, 2026
536abd5
CustomVariableValueApplier: clean up the code
raviks789 Jul 17, 2026
febb86c
IcingaObjectHandler: Set allowOverrides param by default to false
raviks789 Jul 17, 2026
5833c0d
DictionaryItem: Add missing return statement to populate()
raviks789 Jul 17, 2026
adfa3e5
CustomVariableForm: Preserve item typ for datalists on saving to DB
raviks789 Jul 17, 2026
bb85e2c
HostController: Replace deprecated ON_SUCCESS with ON_SUBMIT for Host…
raviks789 Jul 20, 2026
314bfd2
Replace deprecated createCsrfCounterMeasure() with addCsrfCounterMeas…
raviks789 Jul 20, 2026
84b7d07
IplBoolean: Avoid using null as an array offset
raviks789 Jul 20, 2026
13ad21f
Restore required flag when relinking already attached custom properties
raviks789 Jul 20, 2026
767308d
DirectorProperty: Make key_name unique constraint case insensitive on…
raviks789 Jul 20, 2026
482cd79
IcingaService: resolve legacy $config$ alias when rendering apply-for…
raviks789 Jul 20, 2026
05ca6bc
Stop rewriting untouched siblings in fixed arrays and dictionaries
raviks789 Jul 21, 2026
2841c63
Fix apply-for name matching for dictionary valued host vars
raviks789 Jul 21, 2026
c9cb90a
Delete target-only child properties on basket restore
raviks789 Jul 21, 2026
421d36a
RestApi: preserve required flag when a PUT relinks custom properties
raviks789 Jul 21, 2026
88c92e1
Accept array valued datalists in the REST validator
raviks789 Jul 21, 2026
9a3f56c
Make datafield migration and delete atomic together
raviks789 Jul 21, 2026
cbece00
Wrap custom variable form writes in a transaction
raviks789 Jul 21, 2026
39d21ef
Scope dictionary and array sensitivity metadata to the object's own p…
raviks789 Jul 21, 2026
1da2f96
DirectorProperty: Reject 'sensitive' as dynamic-array child value_type
raviks789 Jul 21, 2026
66c131f
Add required flag for custom variables
raviks789 Jul 21, 2026
a55c518
Fix required check ignoring inherited values and fixed array defaults
raviks789 Jul 21, 2026
6138e88
CustomVarRenderer: Have one parameter per line in multline function d…
raviks789 Jul 21, 2026
ddf9830
Fix crash when checking unchanged fixed-array/dictionary children
raviks789 Jul 21, 2026
46ae729
Document required custom variables and fix stale doc claims
raviks789 Jul 21, 2026
212880c
DictionaryItem: Clarify that the required flag only applies to inheri…
raviks789 Jul 21, 2026
467a78b
Restrict required-checkbox selector to direct child
raviks789 Jul 21, 2026
5d48f06
ObjectImporter: Unset the left over 'customVariables' key for the ser…
raviks789 Jul 22, 2026
bf27ca9
Fix stale custom variable data left behind after delete or retype
raviks789 Jul 22, 2026
eebfe98
Fix rename propagation for custom variables without a property_uuid link
raviks789 Jul 22, 2026
e446dea
Fix rename path for grandchildren under fixed dictionaries and arrays
raviks789 Jul 22, 2026
12bd049
Fix basket diff missing nested custom variable changes
raviks789 Jul 22, 2026
5f34747
Replace placeholder test data with realistic examples
raviks789 Jul 22, 2026
7087c84
Fix wrong expectation in the property_uuid-less delete test
raviks789 Jul 22, 2026
02d32e2
DictionaryItem: Fix 'item_required' affiliation
raviks789 Jul 22, 2026
9e8c116
Stamp property_uuid on custom var rows during basket restore
raviks789 Jul 22, 2026
c8e6945
CustomVarFieldsTable: Center the text in the table vertically for eac…
raviks789 Jul 23, 2026
ab9ece0
CustomVariables: Add `varname` correlation to join in prefetchCustomV…
raviks789 Jul 27, 2026
acfbcb5
CustomVariables: Fix phpcs error due to missing space after `!`
raviks789 Jul 27, 2026
a8bc90c
BasketSnapshotCustomVariableResolver: Add a check for unknown UUIDs i…
raviks789 Jul 27, 2026
540f494
DictionaryItem: Prevent null values for $type and $label
raviks789 Jul 27, 2026
9384e31
CustomVariableValueCleaner: Ensure string arguments are explicitly ca…
raviks789 Jul 27, 2026
5743001
BasketSnapshotCustomVariableResolver: Update comment for clarity in c…
raviks789 Jul 27, 2026
d8cff77
DirectorProperty: Fix null override of category name during basket re…
raviks789 Jul 27, 2026
f051dc4
DirectorProperty: Block fixed-array, fixed-dictionary and dynamic-dic…
raviks789 Jul 27, 2026
eec0594
Tests: close coverage gaps in the nesting-guard test suite
raviks789 Jul 27, 2026
694b10a
DirectorProperty: Add self-referential FK so orphaned children can't …
raviks789 Jul 27, 2026
e672c60
doc: Fix dynamic-array nesting rule and add missing example
raviks789 Jul 27, 2026
91bae60
IcingaService: explain why apply-for lookup needs no host scoping
raviks789 Jul 27, 2026
a0fe72b
Tests: cover keepPropertyInPlace retype path in the value cleaner
raviks789 Jul 27, 2026
7380089
Tests: cover removeObjectCustomVars for a service var
raviks789 Jul 27, 2026
8f9ce00
DirectorProperty: store a pending category instead of dropping it sil…
raviks789 Jul 27, 2026
ce61110
Tests: cover category restore onto a fresh DB
raviks789 Jul 27, 2026
dfc23cd
DirectorProperty: drop ON UPDATE CASCADE from parent FK
raviks789 Jul 28, 2026
5291562
Fix teardown in category restore test
raviks789 Jul 28, 2026
feb8880
Drop tests that build illegal nested container properties
raviks789 Jul 28, 2026
fcf09dc
DirectorProperty: block sensitive under a datalist too
raviks789 Jul 28, 2026
0e80fcf
DirectorProperty: add bool round-trip test
raviks789 Jul 28, 2026
9ea055d
doc: spell out fixed-array cannot nest inside itself
raviks789 Jul 28, 2026
6a65c6a
DirectorProperty: block sensitive child when switching type to an arr…
raviks789 Jul 28, 2026
c54fbca
Tests: cover switching a property's type when it has a sensitive child
raviks789 Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ jobs:
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git _libraries/ipl
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git _libraries/vendor

- name: Setup Icingadb
run: |
git clone --depth 1 https://github.com/Icinga/icingadb-web.git _icingaweb2/modules/icingadb
mkdir -p test/config/enabledModules
cd _icingaweb2/modules/icingadb
ln -s `pwd` ../../../test/config/enabledModules/icingadb

- name: Setup Incubator
run: |
git clone --depth 1 https://github.com/Icinga/icingaweb2-module-incubator _icingaweb2/modules/incubator
Expand Down
21 changes: 21 additions & 0 deletions application/clicommands/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ public function datafieldsAction()
);
}

/**
* Export all CustomProperty definitions
*
* USAGE
*
* icingacli director export customproperties [options]
*
* OPTIONS
*
* --no-pretty JSON is pretty-printed per default
* Use this flag to enforce unformatted JSON
*/
public function custompropertiesAction()
{
$export = new ImportExport($this->db());
echo $this->renderJson(
$export->serializeAllCustomProperties(),
! $this->params->shift('no-pretty')
);
}

/**
* Export all DataList definitions
*
Expand Down
107 changes: 107 additions & 0 deletions application/clicommands/HostsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
namespace Icinga\Module\Director\Clicommands;

use Icinga\Module\Director\Cli\ObjectsCommand;
use Icinga\Module\Director\Db\DbUtil;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaObject;
use PDO;
use Ramsey\Uuid\Uuid;

/**
* Manage Icinga Hosts
Expand All @@ -11,4 +16,106 @@
*/
class HostsCommand extends ObjectsCommand
{
/**
* Updates the custom variables associated with objects by syncing them with their corresponding
* custom variable uuids, and stores the updated variables in the database.
*
* @return void
*/
public function refreshCustomVarsAction(): void
{
foreach ($this->getObjects() as $o) {
$vars = $o->vars();
$objectCustomVariables = $this->getObjectCustomVariables($o);

foreach ($objectCustomVariables as $key => $property) {
$var = $vars->get($key);
if ($var && $property['uuid'] !== null) {
$var->setUuid(Uuid::fromBytes($property['uuid']));
$vars->set($key, $var);
}
}

$vars->storeToDb($o);
}
}

/**
* Retrieves custom variables of the given Icinga object.
*
* @param IcingaObject $object The Icinga object whose custom variables need to be fetched.
*
* @return array An associative array of custom variables keyed by their names and their configuration details.
*/
private function getObjectCustomVariables(IcingaObject $object): array
{
if ($object->uuid === null) {
return [];
}

$objectType = $object->getShortTableName();

$parents = $object->listAncestorIds();

$uuids = [];
$db = $object->getConnection();

foreach ($parents as $parent) {
$uuids[] = DbUtil::binaryResult(IcingaHost::loadWithAutoIncId($parent, $db)->get('uuid'));
}

$uuids[] = DbUtil::binaryResult($object->get('uuid'));
$types = [
'string',
'sensitive',
'number',
'bool',
'fixed-array',
'dynamic-array',
'fixed-dictionary',
'dynamic-dictionary'
];

if ($db->isPgsql()) {
$cases = [];
foreach ($types as $i => $type) {
$cases[] = "WHEN '$type' THEN " . ($i + 1);
}

$valueTypeOrder = 'CASE dp.value_type ' . implode(' ', $cases) . ' ELSE ' . (count($types) + 1) . ' END';
} else {
$valueTypeOrder = "FIELD(dp.value_type, '" . implode("', '", $types) . "')";
}

$query = $db->getDbAdapter()
->select()
->from(
['dp' => 'director_property'],
[
'key_name' => 'dp.key_name',
'uuid' => 'dp.uuid',
$objectType . '_uuid' => 'iop.' . $objectType . '_uuid',
'value_type' => 'dp.value_type',
'label' => 'dp.label',
'children' => 'COUNT(cdp.uuid)'
]
)
->join(['iop' => "icinga_$objectType" . '_property'], 'dp.uuid = iop.property_uuid', [])
->joinLeft(['cdp' => 'director_property'], 'cdp.parent_uuid = dp.uuid', [])
->where(
'iop.' . $objectType . '_uuid IN (?)',
DbUtil::quoteBinaryCompat($uuids, $db->getDbAdapter())
)
->group(['dp.uuid', 'dp.key_name', 'dp.value_type', 'dp.label'])
->order($valueTypeOrder)
->order('children')
->order('key_name');

$result = [];
foreach ($db->getDbAdapter()->fetchAll($query, fetchMode: PDO::FETCH_ASSOC) as $row) {
$result[$row['key_name']] = DbUtil::normalizeRow($row);
}

return $result;
}
}
Loading
Loading