Director Selfservice API local repo

Hello again guys,

Im trying to make the local file server repo work (no server-internet connection) and i had to manually download the files to it and create it with new ifw.repo.json being generated by the icinga framework.

Then i took the script thats generated by the director, changed it to point to local repo.

All is well and good until i get the “failed to deserialize json or command error”

This is the modified script:

[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11';
$ProgressPreference                         = 'SilentlyContinue';
[string]$ScriptFile                         = '\\fileserver\IcingaRepo\IcingaForWindows.ps1';


& $ScriptFile `
    -ModuleDirectory  'C:\Program Files\WindowsPowerShell\Modules\' `
    -InstallCommand   '{"IfW-DirectorSelfServiceKey":{"Values":["1111111112222222222333333333"]},"IfW-DirectorUrl":{"Values":["http://icinga/icingaweb2/director/"]},"IfW-StableRepository":{"Values":["\\fileserver\IcingaRepo\ifw.repo.json"]}}' `
    -IcingaRepository '\\$fileserver$\IcingaRepo\ifw.repo.json'

Does this not support fileserver shares for repo locations? Since its willing to take URL with no problem.

BR,
Terro

Hi @Terrorkkar,
line 3 $ScriptFile normally points to the local path of the Install script. Are you sure, you can execute that from the fileshare?

Apart from that, I would have guessed, that there is a syntax error in your JSON somewhere (either the stuff after -InstallCommand or your ifw.repo.json).
Could you try to verify that the syntax is ok? (use jq or some good editor for that)

line 3 $ScriptFile normally points to the local path of the Install script. Are you sure, you can execute that from the fileshare?

I gave it everyone permissions for testing and used domain admin to execute the script. Also tried running from local PC, its the same issue.

Apart from that, I would have guessed, that there is a syntax error in your JSON somewhere (either the stuff after -InstallCommand or your ifw.repo.json).

-InstallCommand stuff was generated by director the only thing that was changed was repository location from

"IfW-StableRepository":{"Values":["https://packages.icinga.com/IcingaForWindows/stable"]}

to

"IfW-StableRepository":{"Values":["\\fileserver\IcingaRepo\"]}

And as far as the ifw.repo.json goes this was autogenerated by the:

New-IcingaRepository `
    -Name 'My Local Repo' `
    -Path '\\fileserver\IcingaRepo';

This i think is the last step to make it work from local repos, so any help would be much appreciated.

Error msg:

[Error]: Failed to deserialize the provided JSON from file or command: Unrecognized escape sequence. (199): {"IfW-DirectorSelfServiceKey":{"Values":["11111111112222222222222333333"]},"IfW-DirectorUrl":{"Values":["http://icinga/icingaweb2/director/"]},"IfW-StableRepos
itory":{"Values":["\\fileserver\icingarepo"]}}

BR,
Terro

I have figured out the issue, it was of the skill issue nature haha.

JSON files escape the backslash character, you have to double it.

So correct path to the file share is something like:

"IfW-StableRepository":{"Values":["\\\\fileserver\\IcingaRepo"]}

Note the doubled amount of backslashes.

BR,
Terro

2 Likes