Skip to content

Added a define that wraps the agent integration command#534

Merged
albertvaka merged 4 commits intomasterfrom
albertvaka/integration_install
Jun 19, 2019
Merged

Added a define that wraps the agent integration command#534
albertvaka merged 4 commits intomasterfrom
albertvaka/integration_install

Conversation

@albertvaka
Copy link
Copy Markdown
Contributor

No description provided.

Our tests won't run on anything older than 4.6
@albertvaka albertvaka force-pushed the albertvaka/integration_install branch from 9163b02 to a938f0a Compare June 17, 2019 08:39
Copy link
Copy Markdown
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

Thanks a bunch for doing this, I left some feedback but we're on a great track :)

Comment thread Gemfile Outdated
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.

Shouldn't ~> 4.6.0 basically give you the upper bound on 4.6.x ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

'~> 4.6.2' == '4.6.2 < version < 4.7.0'
'~> 4.6.0' == '4.6.0 < version < 4.7.0'

I didn't assume it works on 4.6.0 because on Travis we test with 4.6.2.

Comment thread manifests/install_integration.pp Outdated
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.

This should probably require something like:

    require => Package[$datadog_agent::params::package_name],

We probably don't need to notify, we can leave that to the config file definition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

Comment thread README.md Outdated
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.

We should probably state here how the installation of the integration should happen in the manifests before the config file definition for the integration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does the config file definition need the integration to be installed in order to generate the config file?

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.

No, it's not needed, but since we're not restarting the agent here - we'd be relying on the config file for that, and steps would need to be in order (actually this might not be entirely true if the config files trigger the service restart in a delayed fashion). Alternatively, maybe ideally (though I'm not sure because technically speaking installing an integration does not imply it's enabled), we could notify the service to restart here, maybe in a delayed fashion. And then we could forget any changes to the docs, as they'd be moot.

Comment thread manifests/install_integration.pp Outdated
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.

This has a slight problem, given that if a customer installs an integration, this will install it with every run, making the module chatty. Ideally we'd want to only add the resource if the integration has not been installed (same goes for absent).

You might be able to check for the existence of /opt/datadog-agent/embedded/lib/python<PYVERSION>/site-packages/datadog_<integration>-<version>.dist-info to decide if you go forward with the execution or not. Or you could ask pip.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The integration command is idempotent, and exec only prints if the command ends with a non-zero status (so it won't make extra work and it won't be chatty).

I find it way cleaner to rely on the integration command doing the check than us digging into some (version-dependent) path to check for some internal pip files.

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.

I wasn't sure if integration was idempotent, it's good to hear it is. I think this would still make the module chatty though, signaling resource changes when no real resource has changed or should've been changed. If you can verify it's not the case, then I naturally don't see a need to change anything - but if it does, we probably should reconsider the approach.

Comment thread manifests/install_integration.pp Outdated
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.

How does the tool handle python2, python3 integration installations? I presume it installs for the python specified in the datadog.yaml.... Let's keep that in mind as a use case for the module, particularly when you check for an integration's presence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it does what you say, but in any case puppet should just assume the integration command does the right thing when multiple pythons are installed.

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.

This is true if we rely on the integration command entirely, but we first need to make sure the module isn't chatty before going for this approach.

@albertvaka albertvaka force-pushed the albertvaka/integration_install branch from a938f0a to ed172a2 Compare June 19, 2019 12:27
@albertvaka
Copy link
Copy Markdown
Contributor Author

Any comments about the name? I couldn't think of anything better than install_integration, but let me know if you have any ideas.

@albertvaka albertvaka force-pushed the albertvaka/integration_install branch from 97b132d to b54b829 Compare June 19, 2019 13:37
@albertvaka albertvaka force-pushed the albertvaka/integration_install branch from b54b829 to e41a2eb Compare June 19, 2019 13:38
Copy link
Copy Markdown
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

I think this is good for 🚀

@albertvaka albertvaka merged commit 0c64d50 into master Jun 19, 2019
@albertvaka albertvaka deleted the albertvaka/integration_install branch June 19, 2019 19:27
cegeka-jenkins pushed a commit to cegeka/puppet-datadog_agent that referenced this pull request Apr 6, 2020
…stall

Added a define that wraps the agent integration command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants