Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Changed arguments from [bool] to [switch]
Browse files Browse the repository at this point in the history
[#60] Changed arguments from datatype [bool] to [switch], to get rid of $TRUE / $FALSE values from arguments (example: -AllowUpdates instead of -AllowUpdates $TRUE)
* Updated documentation
* Updated changelog
  • Loading branch information
LordHepipud committed Nov 20, 2017
1 parent 554c971 commit 2393aed
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 52 deletions.
54 changes: 27 additions & 27 deletions Icinga2Agent/Icinga2Agent.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,35 @@ function Icinga2AgentModule {
[string]$AgentName,
[string]$Ticket,
[string]$InstallAgentVersion,
[bool]$FetchAgentName = $FALSE,
[bool]$FetchAgentFQDN = $FALSE,
[int]$TransformHostname = 0,
[switch]$FetchAgentName = $FALSE,
[switch]$FetchAgentFQDN = $FALSE,
[int]$TransformHostname = 0,

# Agent configuration
[int]$AgentListenPort = 5665,
[int]$AgentListenPort = 5665,
[string]$ParentZone,
[bool]$AcceptConfig = $TRUE,
[bool]$IcingaEnableDebugLog = $FALSE,
[bool]$AgentAddFirewallRule = $FALSE,
[bool]$AcceptConfig = $TRUE,
[switch]$IcingaEnableDebugLog = $FALSE,
[switch]$AgentAddFirewallRule = $FALSE,
[array]$ParentEndpoints,
[array]$EndpointsConfig,
[array]$GlobalZones = @( 'director-global' ),
[array]$GlobalZones = @( 'director-global' ),

# Agent installation / update
[string]$IcingaServiceUser,
[string]$DownloadUrl = 'https://packages.icinga.com/windows/',
[string]$DownloadUrl = 'https://packages.icinga.com/windows/',
[string]$AgentInstallDirectory,
[bool]$AllowUpdates = $FALSE,
[switch]$AllowUpdates = $FALSE,
[array]$InstallerHashes,
[bool]$FlushApiDirectory = $FALSE,
[switch]$FlushApiDirectory = $FALSE,

# Agent signing
[string]$CAServer,
[string]$CACertificatePath,
[int]$CAPort = 5665,
[bool]$ForceCertificateGeneration = $FALSE,
[int]$CAPort = 5665,
[switch]$ForceCertificateGeneration = $FALSE,
[string]$CAFingerprint,
[switch]$CAProxy = $FALSE,
[switch]$CAProxy = $FALSE,

# Director communication
[string]$DirectorUrl,
Expand All @@ -45,29 +45,29 @@ function Icinga2AgentModule {
[string]$DirectorDomain,
[string]$DirectorAuthToken,
[System.Object]$DirectorHostObject,
[bool]$DirectorDeployConfig = $FALSE,
[switch]$DirectorDeployConfig = $FALSE,

# NSClient Installer
[bool]$InstallNSClient = $FALSE,
[bool]$NSClientAddDefaults = $FALSE,
[bool]$NSClientEnableFirewall = $FALSE,
[bool]$NSClientEnableService = $FALSE,
[switch]$InstallNSClient = $FALSE,
[switch]$NSClientAddDefaults = $FALSE,
[switch]$NSClientEnableFirewall = $FALSE,
[switch]$NSClientEnableService = $FALSE,
[string]$NSClientDirectory,
[string]$NSClientInstallerPath,

# Uninstaller arguments
[bool]$FullUninstallation = $FALSE,
[bool]$RemoveNSClient = $FALSE,
[switch]$FullUninstallation = $FALSE,
[switch]$RemoveNSClient = $FALSE,

# Dump Config arguments
[switch]$DumpIcingaConfig = $FALSE,
[switch]$DumpIcingaObjects = $FALSE,
[switch]$DumpIcingaConfig = $FALSE,
[switch]$DumpIcingaObjects = $FALSE,

#Internal handling
[switch]$RunInstaller = $FALSE,
[switch]$RunUninstaller = $FALSE,
[switch]$IgnoreSSLErrors = $FALSE,
[bool]$DebugMode = $FALSE,
[switch]$RunInstaller = $FALSE,
[switch]$RunUninstaller = $FALSE,
[switch]$IgnoreSSLErrors = $FALSE,
[switch]$DebugMode = $FALSE,
[string]$ModuleLogFile
);

Expand Down
20 changes: 10 additions & 10 deletions doc/10-Basic-Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tell you which Ticket you will require for your host
You can either leave this parameter or add it to allow the module to install or update the Icinga 2
Agent on your system. It has to be a string value and look like this for example:
```powershell
-InstallAgentVersion '2.6.3'
-InstallAgentVersion '2.8.0'
```

**Important:** This argument is required in order to install, update or downgrade the Icinga 2
Expand Down Expand Up @@ -166,7 +166,7 @@ base download Url / Directory**, as the Module **will generate the MSI file name
system architecture and the version to install**. The Icinga 2 MSI Installer name is internally build
as follows: *Icinga2-v[InstallAgentVersion]-[OSArchitecture].msi*

Full example: Icinga2-v2.6.3-x86_64.msi
Full example: Icinga2-v2.8.0-x86_64.msi

Default value: **https://packages.icinga.com/windows/**

Expand All @@ -181,7 +181,7 @@ installed into. The old directory will be removed caused by the required uninsta
**Examples:**
```powershell
-AgentInstallDirectory 'C:\MyIcinga2Agent'
-AllowUpdates $TRUE -InstallAgentVersion '2.6.3' -AgentInstallDirectory 'C:\MyNewIcinga2Agent'
-AllowUpdates -InstallAgentVersion '2.8.0' -AgentInstallDirectory 'C:\MyNewIcinga2Agent'
```

## -AllowUpdates (optional)
Expand Down Expand Up @@ -214,7 +214,7 @@ package is not matching one of the provided hashes of this parameter.
## -FlushApiDirectory (optional)

In case the Icinga Agent will accept configuration from the parent Icinga 2 system, it will possibly
write data to /var/lib/icinga2/api/* By setting this parameter to *$TRUE*, all content inside the api
write data to /var/lib/icinga2/api/* By adding this parameter to your script call, all content inside the api
directory will be flushed once a change is detected by the module which requires a restart of the
Icinga 2 Agent

Expand All @@ -236,7 +236,7 @@ Default value: **5665**
## -ForceCertificateGeneration (optional)

The module will generate the certificates in general only if one of the required files is missing. By
setting this parameter to $TRUE, the module will force the re-creation of the certificates.
adding this parameter to your call, the module will force the re-creation of the certificates.

Default value: **$FALSE**

Expand Down Expand Up @@ -309,18 +309,18 @@ a custom variable and executing the uninstallation function of the monitoring co

**Instead of**
```powershell
$icinga = Icinga2AgentModule `
-FullUninstallation $TRUE `
-RemoveNSClient $TRUE
$icinga = Icinga2AgentModule `
-FullUninstallation `
-RemoveNSClient
exit $icinga.uninstall();
```

**You can use**
```powershell
exit Icinga2AgentModule `
-FullUninstallation $TRUE `
-RemoveNSClient $TRUE `
-FullUninstallation `
-RemoveNSClient `
-RunUninstaller;
```

Expand Down
2 changes: 1 addition & 1 deletion doc/11-Director-Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ For a simplier configuration in certain cases, you can use the [placeholders](31
the hostname or the ip address.

### -DirectorDeployConfig
If this parameter is set to **$TRUE**, the PowerShell module will tell the Icinga Director to deploy
If you add this parameter to your script call, the PowerShell module will tell the Icinga Director to deploy
outstanding configurations. This parameter can be used in combination with -DirectorHostObject, to
create objects and deploy them right away. This argument requires the user and password argument and
will not work with the Self Service api.
Expand Down
4 changes: 2 additions & 2 deletions doc/12-NSClient-Arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Default value: **$FALSE**
## -NSClientEnableFirewall
By default the NSClient++ installer is adding an exception for the Windows Firewall, allowing the
external communication with the NSClient. By default the PowerShell module will remove this firewall
rule from the Windows System. To keep it, set this value to **$TRUE**
rule from the Windows System. To keep it, add this argument to your script call.

Default value: **$FALSE**

## -NSClientEnableService
By default a service is installed for the NSClient++, allowing remote checks like nrpe to connect in
case the NSClient++ is listening on an available port / ip and the firewall is setup correctly. By
default the service will be stopped and removed from the system by the PowerShell module. In case you
want to keep it, set this value to **$TRUE**
want to keep it, add this argument to your script call.

Default value: **$FALSE**

Expand Down
4 changes: 2 additions & 2 deletions doc/13-Icinga2-CA-Proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Full Example:
```powershell
Icinga2AgentModule `
-InstallAgentVersion 2.8.0 `
-AllowUpdates $TRUE `
-AllowUpdates `
-ParentZone 'icinga-master' `
-ParentEndpoints 'icinga2a', 'icinga2b' `
-FetchAgentFQDN $TRUE `
-FetchAgentFQDN `
-CAProxy `
-CACertificatePath 'C:\certs\ca.crt' `
-RunInstaller;
Expand Down
16 changes: 8 additions & 8 deletions doc/30-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The PowerShell module provides a feature to enable / disable the Icinga 2 debug
log, simply use this function call:

```powershell
$icinga = Icinga2AgentModule -IcingaEnableDebugLog $TRUE
$icinga = Icinga2AgentModule -IcingaEnableDebugLog
exit $icinga.install();
```
Expand Down Expand Up @@ -89,9 +89,9 @@ Icinga Director

```powershell
$icinga = Icinga2AgentModule `
-InstallAgentVersion '2.6.3' `
-AllowUpdates $TRUE `
-FetchAgentFQDN $TRUE `
-InstallAgentVersion '2.8.0' `
-AllowUpdates `
-FetchAgentFQDN `
-DirectorUrl 'https://icinga2a-master.example.com/icingaweb2/director/' `
-DirectorUser 'icingaadmin' `
-DirectorPassword 'icinga' `
Expand All @@ -114,15 +114,15 @@ available values.

```powershell
$icinga = Icinga2AgentModule `
-InstallAgentVersion '2.6.3' `
-AllowUpdates $TRUE `
-FetchAgentFQDN $TRUE `
-InstallAgentVersion '2.8.0' `
-AllowUpdates `
-FetchAgentFQDN `
-DirectorUrl 'https://icinga2a-master.example.com/icingaweb2/director/' `
-DirectorUser 'icingaadmin' `
-DirectorPassword 'icinga' `
-DirectorHostObject '{"object_name":"&hostname_placeholder&","object_type":"object","vars":{"os":"Windows"},"imports":["Icinga Agent"],"address":"&hostname_placeholder&","display_name":"&hostname_placeholder&"}' `
-CAServer 'icinga2a-master.example.com' `
-DirectorDeployConfig $TRUE `
-DirectorDeployConfig `
-ParentZone 'icinga2-master-zone' `
-ParentEndpoints 'icinga2a-master.example.com', 'icinga2b-master.example.com' `
Expand Down
4 changes: 2 additions & 2 deletions doc/31-Uninstall-Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ This example will uninstall the Agent and remove the Program Data Directory as w
that, you can remove the argument '-FullUninstallation'

```powershell
$icinga = Icinga2AgentModule -FullUninstallation $TRUE
$icinga = Icinga2AgentModule -FullUninstallation
exit $icinga.uninstall();
```

**Shorten the call**
```powershell
exit Icinga2AgentModule -FullUninstallation $TRUE -RunUninstaller;
exit Icinga2AgentModule -FullUninstallation -RunUninstaller;
```
33 changes: 33 additions & 0 deletions doc/70-Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
Changelog
==============

1.2.0
-----

### Fixed issues and related features
* You can find issues and feature requests related to this release on our
[roadmap](https://github.com/Icinga/icinga2-powershell-module/milestone/3?closed=1)

* Added support for Icinga 2.8.0 and above
* Added support for Icinga 2 CA-Proxy
* Changed argument boolean values to switch, which changes
```powershell
-AllowUpdates $TRUE
```

to

```powershell
-AllowUpdates
```

for example. This applies to all values, except for **-AcceptConfig**

1.1.0
-----

### Fixed issues and related features
* You can find issues and feature requests related to this release on our
[roadmap](https://github.com/Icinga/icinga2-powershell-module/milestone/2?closed=1)

* Added additional troubleshooting support for dumping Icinga 2 configuration and objects
* Improved documentation for PowerShell 2 support and installation
* Fixed code stylings

1.0.0
-----

Expand Down

0 comments on commit 2393aed

Please sign in to comment.