linuxpatch / linuxpatch-puppet

Automate the installation of the LinuxPatch.com, a Patch Management platform for Linux servers. Compatible with Debian, Ubuntu, CentOS, Redhat, Rocky Linux, AlmaLinux, Amazon Linux, and more. Ideal for efficient management of multiple nodes.
https://linuxpatch.com
1 stars 0 forks source link

Puppet module improvements #1

Closed jay7x closed 1 month ago

jay7x commented 3 months ago

Hello from Puppet community! :)

Just found your module while googling for Dell DRM (you have an article about its vulnerability on your site). It looks like you have hard times learning how to create a Puppet module :)

I'd suggest to do these steps to make your module following all the best practices of the Puppet world :)

  1. Install PDK. I see your metadata.json has the PDK template reference, but you removed everything else it seems.
  2. Run pdk new module linuxpatch linuxpatch-puppet. This will create a Puppet module linuxpatch in the directory linuxpatch-puppet (it shouldn't exists, pdk will create it for you). Here you should answer few questions:
    • Your Puppet Forge username (if any). It's highly recommended to create an account on Puppet Forge. This is kind of Ansible Galaxy or DockerHub, where every useful module should be published on. We can discuss it later.
    • Module's author name. As I see in the existing metadata.json, your name is linuxpatch, which is fine
    • Module license. I see your one is Apache-2.0, which is also fine.
    • OS supported. This depends on which OS your software supports. As I see, it's Debian family and RedHat family distros at the moment.
    • Select Y (press Enter actually) and PDK will generate the module structure for you. There is a bunch of files. It might be hard to understand what every file is for, but I'd suggest leave it as it is for now.
  3. Place your existing linuxpatch.pp to manifests/init.pp (this is where Puppet will look for a class of the module name)
  4. Update README.md with your module related information (check puppetlabs-ntp for example). Though, your existing README.md might be good enough if you promise to update it later :-D
  5. Run pdk validate. See the style and documentation issues :-D. Run pdk validate -a to autocorrect the indentation.
  6. Add the following as first lines of the manifests/init.pp file (quick-fixing documentation issues, see this for details):
    # @summary This class manages LinuxPatch.com agent installation` as 1st line of your `init.pp` file
    # @param api_key API key value
  7. Run pdk validate again. Enjoy having no issues.
  8. Run pdk release prep. Here is another bunch of questions:
    • Do you want to run the module validation ? - Yes
    • Do you want to run the automatic changelog generation ? - No (this requires additional setup, let's skip for now)
    • Do you want to set the module version ? - Yes
    • Do you want to run the dependency-checker on this module? - Yes
    • Do you want to update the documentation for this module? - Yes (this will generate REFERENCE.md after the interview)
    • Please set the module version - 0.1.0 is good for start (this is the module version, not your linuxpatch software version)
    • Summarize the purpose of this module in a single sentence. - As this line should be less than 140 chars, I crafted "This module installs LinuxPatch.com patch management agent, enabling secure, real-time updates". But it's up to you what to put there. Just take care of length, as pdk validate might complain otherwise.
    • If there is a source code repository for this module, enter the URL here. - https://github.com/linuxpatch/linuxpatch-puppet
    • If there is a URL where others can learn more about this module, enter it here. - https://linuxpatch.com
    • If there is a public issue tracker for this module, enter its URL here. - https://github.com/linuxpatch/linuxpatch-puppet/issues
    • Metadata will be generated based on this information, continue? - Yes.
  9. At this point PDK should fill all the missing fields in the metadata.json, do the validation, and generate the REFERENCE.md documentation.
  10. Run pdk build. This will generate a gzipped tarball archive, which you can upload manually to the Puppet Forge. This step might be automated with pdk release publish and Forge token later.

There is another way to use Voxpupuli community tooling and release workflow for the module (with commercial support option available)

Feel free to ask questions if any!

hzba1 commented 3 months ago

Hi there,

Thank you for your issue. We pushed a new version and updated our namespace to match best practices: https://forge.puppet.com/modules/linuxpatch/agent

Warm Regards,

jay7x commented 3 months ago

@hzba1 Ah, nice! Though I'd still suggest to adopt PDK to check for style issues. Also your README is a bit de-synced now around installation part. You can drop the installation part as it's generated by Forge automatically. Just keep the usage block.

hzba1 commented 3 months ago

Hi @jay7x, thanks for tips! We pushed a commit to fix our README :+1: