icinga2-diagnostics icon indicating copy to clipboard operation
icinga2-diagnostics copied to clipboard

In Director version detection add a variable that is set to true if anything else than a release is found.

Open widhalmt opened this issue 7 years ago • 5 comments

Maybe even when a release as a git clone is found because this might indicate that the user just wants to use git but it also might indicate that they just hit a release by default.

widhalmt avatar Jan 11 '18 16:01 widhalmt

@widhalmt: I disagree, having a GIT working directory is the best what could happen to you when you want to figure out the installed version. Please use at least something like git describe, or some shell voodoo like this:

grep -q ^ref: .git/HEAD && cat .git/$(grep ^ref: .git/HEAD | cut -d ' ' -f 2)

Whether a working directory is dirty (check porcelain, git status) might be very interesting to know. There is absolutely no better place for all this diagnose work than ... well, I have to repeat myself, a cloned GIT repository :-)

Thomas-Gelf avatar Jan 12 '18 00:01 Thomas-Gelf

Ok, then. Thank you for your insights. I was unsure about that but I had to decide for a way to go. To say it with the crusader from Indiana Jones: My choice was bad.

Thanks a lot. I'll add this to the script.

widhalmt avatar Jan 12 '18 08:01 widhalmt

Just to add a bit of information: The Script already fetched the git commit that was used when it found a .git directory. Of course, your shell-fu is mightier than mine so it was just a print of the latest git log entry. Nonetheless I wanted to have this appear in the anomalies section because I saw many users use a git clone without caring if they got a release or just random commit. So I wanted to do both:

  • Show if we are running a Director release or just some random commit
  • Make the supporter aware that there is a git clone in use which might be changed every time.

My assumption was, if someone used a release archive for installation they are likely to do so in the future. If someone uses a git clone with a release it could mean that they checked out a release on purpose or by accident. If the latter ist the case they would do a git pull sometimes and that is what I wanted to make the reader of the output aware of.

Maybe it would be a good idea to check if the used checkout is the freshest commit available in the clone?

widhalmt avatar Jan 12 '18 08:01 widhalmt

Above short snippet should be most of this I guess. Check out a specific tag and try, checkout master - and try again.

Thomas-Gelf avatar Jan 12 '18 08:01 Thomas-Gelf

NB: in case it doesn't, more foo can be added :laughing:

Thomas-Gelf avatar Jan 12 '18 08:01 Thomas-Gelf