# Assign where dictionary key exists in a nested dictionary - possible?

**URL:** <https://community.icinga.com/t/assign-where-dictionary-key-exists-in-a-nested-dictionary-possible/9785>\
**Category:** Icinga 2\
**Created:** [May 5, 2022, 3:02pm UTC](https://community.icinga.com/t/assign-where-dictionary-key-exists-in-a-nested-dictionary-possible/9785 "2022-05-05T15:02:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Napsty](https://community.icinga.com/user_avatar/community.icinga.com/napsty/32/781_2.png) [@Napsty](https://community.icinga.com/u/Napsty)\
**Post date:** [May 6, 2022, 9:56am UTC](https://community.icinga.com/t/assign-where-dictionary-key-exists-in-a-nested-dictionary-possible/9785/3 "2022-05-06T09:56:10Z")

</div>

Thanks for the reply, but writing a function (I took a look at [DSL: Flatten a nested dictionary with a function for apply for rules](https://community.icinga.com/t/dsl-flatten-a-nested-dictionary-with-a-function-for-apply-for-rules/1330)) would complicate things rather than making it easier.  
Unless you have a straightforward example of such a function at hand? 😉

Oh and I can’t use “if” inside the `apply` rule because it is managed by puppet-icinga2.

---

_[View the full topic](https://community.icinga.com/t/assign-where-dictionary-key-exists-in-a-nested-dictionary-possible/9785)._
