Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #13147] AgentScript Compatibility with PowerShell 2 #597

Closed
icinga-migration opened this issue Nov 10, 2016 · 6 comments
Closed
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/13147

Created by siegfried on 2016-11-10 16:07:26 +00:00

Assignee: cstein
Status: Resolved (closed on 2016-12-13 09:41:09 +00:00)
Target Version: 1.3.0
Last Update: 2016-12-13 09:41:09 +00:00 (in Redmine)


This part of the script calls Functions which are available from Version 3

Download the Icinga 2 Agent Installer from out defined source
#
$installer | Add-Member -membertype ScriptMethod -name 'downloadInstaller' -value {
if (-Not $this.config('agent_version')) {
return;
}
$WebStatusCode = 0;
$url = $this.config('download_url') + $this.getProperty('install_msi_package');
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
$execptionMsg = '';
Try {
$WebStatusCode = Invoke-WebRequest -Method Head -Uri "$url"
##### ver 3 of PS #####
if ($WebStatusCode.StatusCode -eq 200) {
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
} else {
throw 'Failed to download Icinga 2 Agent Installer from URL';
}
} catch {
throw 'Unable to download Icinga 2 Agent from ' + $url + '. Error: ' + $_.Exception.Message;
}
}

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-11-10 16:15:01 +00:00

  • Status changed from New to Assigned
  • Assigned to set to cstein

@cstein: any chance we get this working with the PowerShell v2 dinosaur?

@siegfried: on what kind of system did you met PowerShell v2? While v3 is the default since Windows 8, it should also be available for all systems since Windows 7...

@icinga-migration
Copy link
Author

Updated by siegfried on 2016-11-10 16:20:20 +00:00

Hi

It is 2008 R2

see you Siegfried

Am 10.11.2016 um 17:15 schrieb development@icinga.org:

Issue #13147 has been updated by tgelf.

Status changed from New to Assigned
Assignee set to cstein

`cstein: any chance we get this working with the PowerShell v2 dinosaur?

`siegfried: on what kind of system did you met PowerShell v2? While v3 is the default since Windows 8, it should also be available for all systems since Windows 7...


Support #13147: AgentScript Compatibility with PowerShell 2
https://dev.icinga.org/issues/13147#change-56831

* Author: siegfried
* Status: Assigned
* Priority: Normal
* Assignee: cstein
* Category:
* Target version:

This part of the script calls Functions which are available from Version 3

Download the Icinga 2 Agent Installer from out defined source
#
$installer | Add-Member -membertype ScriptMethod -name 'downloadInstaller' -value {
if (-Not $this.config('agent_version')) {
return;
}
$WebStatusCode = 0;
$url = $this.config('download_url') + $this.getProperty('install_msi_package');
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
$execptionMsg = '';
Try {
$WebStatusCode = Invoke-WebRequest -Method Head -Uri "$url"
##### ver 3 of PS #####
if ($WebStatusCode.StatusCode -eq 200) {
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
} else {
throw 'Failed to download Icinga 2 Agent Installer from URL';
}
} catch {
throw 'Unable to download Icinga 2 Agent from ' + $url + '. Error: ' + $_.Exception.Message;
}
}

-- 
Siegfried Eichhorn
Senior Consultant

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | siegfried.eichhorn@netways.de

**** OSMC 2016 - November - netways.de/osmc ****

**** OSDC 2017 - Mai – osdc.de ****

@icinga-migration
Copy link
Author

Updated by cstein on 2016-11-10 16:21:15 +00:00

Yes this would be possible and require some intense tests to ensure it will work on all environments including execution on Windows boot.
But there are solutions available for this.

Best regards
Christian

@icinga-migration
Copy link
Author

Updated by siegfried on 2016-11-10 16:24:57 +00:00

Hi

about PS Versions there is a link

https://4sysops.com/archives/powershell-versions-and-their-windows-version/

see you Siegfried

Am 10.11.2016 um 17:15 schrieb development@icinga.org<mailto:development@icinga.org>:

Issue #13147 has been updated by tgelf.

Status changed from New to Assigned
Assignee set to cstein

@cstein: any chance we get this working with the PowerShell v2 dinosaur?

@siegfried: on what kind of system did you met PowerShell v2? While v3 is the default since Windows 8, it should also be available for all systems since Windows 7...


Support #13147: AgentScript Compatibility with PowerShell 2
https://dev.icinga.org/issues/13147#change-56831

  • Author: siegfried
  • Status: Assigned
  • Priority: Normal
  • Assignee: cstein
  • Category:
  • Target version:

    This part of the script calls Functions which are available from Version 3

Download the Icinga 2 Agent Installer from out defined source
#
$installer | Add-Member -membertype ScriptMethod -name 'downloadInstaller' -value {
if (-Not $this.config('agent_version')) {
return;
}
$WebStatusCode = 0;
$url = $this.config('download_url') + $this.getProperty('install_msi_package');
$this.info('Downloading Icinga 2 Agent Binary from ' + $url + ' ...');
$execptionMsg = '';
Try {
$WebStatusCode = Invoke-WebRequest -Method Head -Uri "$url"
##### ver 3 of PS #####
if ($WebStatusCode.StatusCode -eq 200) {
Invoke-WebRequest "$url" -OutFile $this.getInstallerPath();
} else {
throw 'Failed to download Icinga 2 Agent Installer from URL';
}
} catch {
throw 'Unable to download Icinga 2 Agent from ' + $url + '. Error: ' + $_.Exception.Message;
}
}

-- 
Siegfried Eichhorn
Senior Consultant

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | siegfried.eichhorn@netways.de

**** OSMC 2016 - November - netways.de/osmc ****

**** OSDC 2017 - Mai – osdc.de ****

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-11-10 16:35:17 +00:00

cstein, siegfried: thanks.

@siegfried: any chance you can upgrade those systems from that insanely old version, or are you forced to stick with them?

cstein: could you check with siegfried whether and under which conditions it would be possible to block the time you need to get this accomplished?

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-12-13 09:41:09 +00:00

  • Status changed from Assigned to Resolved
  • Target Version set to 1.3.0

Should have been fixed with ac3e541, thanks Christian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant