Skip to content

Conversation

@nicoske
Copy link

@nicoske nicoske commented Oct 10, 2025

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Auxiliary tags can only be referenced in the tag_group module but cannot be managed.

What is the new behavior?

  • Added new aux_tag module to manage auxiliary tags

Other information

This module fills a gap to manage auxiliary tags creation and management before being referenced in tag groups.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@nicoske
Copy link
Author

nicoske commented Oct 10, 2025

I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA.

@Checkmk Checkmk deleted a comment from nicoske Oct 15, 2025
@robin-checkmk robin-checkmk self-assigned this Oct 15, 2025
@robin-checkmk robin-checkmk linked an issue Oct 16, 2025 that may be closed by this pull request
@robin-checkmk
Copy link
Member

Hi @nicoske and thank you so much for your contribution! 🙏
I will fix and finalize the tests, while my colleague will do a code review.
If nothing essential comes up, we will queue this PR for one of the upcoming releases. :)

Copy link
Contributor

@lgetwan lgetwan 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 lot for creating this module!
I added some comments, of which the one in the delete method might be the most crucial one.

Comment on lines +164 to +181
class AuxTagDeleteAPI(CheckmkAPI):
def delete(self): # Remove aux tag
return self._fetch(
code_mapping=HTTP_CODES_DELETE,
endpoint="/objects/aux_tag/%s" % self.params.get("name"),
method="DELETE",
)


class AuxTagGetAPI(CheckmkAPI):
def get(self):
return self._fetch(
code_mapping=HTTP_CODES_GET,
endpoint="/objects/aux_tag/%s" % self.params.get("name"),
method="GET",
)


Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I don't get the idea, but why have you created four ChecckmkAPI classes? I usually created only one, which has a put, get and delete method.
That way, you could also handle getting the etag and putting it into the header directly inside the class.

Comment on lines +212 to +214
auxtagupdate = AuxTagUpdateAPI(module)
auxtagupdate.headers["If-Match"] = result.etag
result = auxtagupdate.put()
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be cool if you only update the aux tag if something has changed. (-> Idempotency).

auxtagupdate.headers["If-Match"] = result.etag
result = auxtagupdate.put()

time.sleep(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the sleep needed to avoid race conditions?
However, I'd rather not do a sleep in the module.

auxtagcreate = AuxTagCreateAPI(module)
result = auxtagcreate.post()

time.sleep(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

auxtagdelete.headers["If-Match"] = result.etag
result = auxtagdelete.delete()

time.sleep(3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

return self._fetch(
code_mapping=HTTP_CODES_DELETE,
endpoint="/objects/aux_tag/%s" % self.params.get("name"),
method="DELETE",
Copy link
Contributor

Choose a reason for hiding this comment

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

This fails in my 2.4.0p14 environment, as deleting is done with a POST on the endpoint /objects/aux_tag/<aux_tag_name>/actions/delete/invoke.

@nicoske nicoske closed this by deleting the head repository Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEED] Implement module for Aux Tags

3 participants