Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to keep templates in sync (no manual changes) #803

Merged
merged 1 commit into from
Oct 28, 2021

Conversation

Fabian1976
Copy link
Contributor

Pull Request (PR) description

Added some stuff to make the template import the same as importing from the GUI. I hope you merge it.

  • Added ability to configure if you want puppet to remove unmanaged items/triggers/graphs etc from Zabbix when they are not in the template
  • Added valuemappings to template import

@root-expert root-expert added the enhancement New feature or request label Oct 27, 2021
@root-expert
Copy link
Member

Hello @Fabian1976 and thanks for the PR! Can you take a look at the failing spec?

Seems the new parameters are not being passed correctly resulting into null values. I didn't see anything obvious from a quick look.

@Fabian1976
Copy link
Contributor Author

Yes, i will have a look. I also can't see what is wrong. I set default values in the template classes, but they seem to be ignored. I didn't ran into any issues when i was locally testing. Will try to troubleshoot it.

@Fabian1976
Copy link
Contributor Author

I think i found why i didn't see this error. I'm using the roles and profiles approach from puppet. In short, i have this in my hiera:

profile::zabbix::full_server::templates:
  'Template Active Directory':
    templ_source: 'puppet:///modules/zabbix_templates_generic/Template Active Directory.xml'

And the shortened code in that profile looks like this:

class profile::zabbix::full_server (
  Optional[Hash] $templates = undef,
){
  if $templates {
    case $zabbix::zabbix_version {
      /^5\.[^0]/: {
        $_defaults = {
          'zabbix_version' => $zabbix::zabbix_version,
        }
      }
      default: {
        $_defaults = {}
      }
    }

    create_resources('::zabbix::template', $templates, $_defaults)
  }
}

So i use the create_resources method in combination with the class zabbix::template (which has default values defined).
And the tests use the custom type zabbix_template directly (which doesn't have default values defined).

I will add default values to the zabbix_template type and check the tests again.

@root-expert
Copy link
Member

Considering squashing your commits once ready 😄

@Fabian1976
Copy link
Contributor Author

Ok, squashed commits and pushed

@root-expert root-expert merged commit cb09a7d into voxpupuli:master Oct 28, 2021
@Fabian1976 Fabian1976 deleted the templates_sync branch September 19, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants