Code Monkey home page Code Monkey logo

Comments (7)

LordHepipud avatar LordHepipud commented on July 22, 2024

The main problem with that is that the module capable of doing quite more than installing the Agent. Determining on when to throw an exception is not that simple, as it could be intendened to simply write configuration or installing the NSClient++, without touching the Icinga 2 Agent at all.

I will try to figure something out for this.

from icinga2-powershell-module.

widhalmt avatar widhalmt commented on July 22, 2024

Maybe you could add a "NoAgentInstallation" flag? I'd suggest the negated form to not break backwards compatibility.

from icinga2-powershell-module.

widhalmt avatar widhalmt commented on July 22, 2024

That way you could check wether not installing is what the user wanted or if it just was an error.

from icinga2-powershell-module.

matthenning avatar matthenning commented on July 22, 2024

Maybe you could implement PowerShell's Common Parameters (https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_commonparameters) or more specifically the -ErrorAction Parameter and decide whether to cancel the setup with exit code 1 or continue when encountering an error based on it's setting.

The official ErrorAction behaviours are

Continue
Ignore
Inquire
SilentlyContinue
Stop
Suspend

from icinga2-powershell-module.

LordHepipud avatar LordHepipud commented on July 22, 2024

Made some additional changes and reverted the exception output in case the installation failed.

Reason: The download URL is defined by default and is not a valid check-source, -InstallAgentVersion can be left without content, as users might not wish to install the Agent but to configure it.

The -ErrorAction argument is not a proper solution, as on which state I'm going to throw an error or not?

I suggest a solution like from @widhalmt would be required, adding an additional argument by default to throw an error in case the Agent can not be installed. Still I'm not happy with that, is it will increase the complexity of the module.

In case the Agent version is not configured, the script will now write a warning:

Warning: Icinga 2 Agent will not be installed. Argument -InstallAgentVersion is not defined.

from icinga2-powershell-module.

LordHepipud avatar LordHepipud commented on July 22, 2024

Another possible solution: Remove default configured -DownloadUrl value. In that case printing an exception in case the -InstallAgentVersion argument is not set would be valid, because the second required argument is not defined.

from icinga2-powershell-module.

LordHepipud avatar LordHepipud commented on July 22, 2024

Re-considered this issue and discussed it internally. I will update the documentation to make clear -InstallAgentVersion is required to be defined in order to install the Icinga 2 Agent. I will however not throw an error or exit the Script with Exit Code 1, as this could be intended from user side. Warnings are however printed and visible within the logfile if enabled (or the console itself)

from icinga2-powershell-module.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.