Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67964

Access to temporarily offline cause is impossible

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • All recent Jenkins versions.
    • 2.340

      Issue
      When creating plugins that handle node availability it is necessary to access a node's temporaryOfflineCause so that it can be examined (e.g. to find out which user set it etc.).
      This can be easily done if the node is still connected (== still has a channel) but if another OfflineCause is set (e.g. because of a connection termination) it is impossible to retrieve the temporaryOfflineCause set previously using a Computer's getOfflineCause method which is the only method available to retrieve OfflineCauses.

      Solution
      Currently temporaryOfflineCause is a private attribute of the Node class and has been since it was added 11 years ago.

      The attribute could either be made public or a getter could be added.
      Since the attribute should most likely not be messed with directly from outside - since setTemporarilyOffline should be used for that - I would propose introducing a simple getter.

          [JENKINS-67964] Access to temporarily offline cause is impossible

          Markus Winter added a comment -

          Markus Winter added a comment - This is addressed by https://github.com/jenkinsci/jenkins/pull/6152

          Tim Ploss added a comment -

          @mawinter69, thanks for your extremely fast reply.

          Yes that PR fixes this issue. Yet at the same time it changes a lot more than is necessary to improve the situation described above.
          Additionally PR-6152 makes a lot of changes that could be rejected. I will open a minimalist PR for fixing only the issue described here.

          Tim Ploss added a comment - @ mawinter69 , thanks for your extremely fast reply. Yes that PR fixes this issue. Yet at the same time it changes a lot more than is necessary to improve the situation described above. Additionally PR-6152 makes a lot of changes that could be rejected. I will open a minimalist PR for fixing only the issue described here.

          Tim Ploss added a comment -

          Tim Ploss added a comment - More minimalist PR: https://github.com/jenkinsci/jenkins/pull/6337

            Unassigned Unassigned
            tploss Tim Ploss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: