Bug: OctopusDSC extension fails when Machine Policy name contains spaces

konstantine's Avatar

konstantine

21 Jan, 2018 05:45 AM

1. Machine Policy names normally contain spaces as the default one does.
2. Attempt to assign the string with spaces to Policy parameter for cTentacleAgent DSC resource causes it to generate syntactically incorrect command line for the Tentacle.exe (to register with the server) which causes registration to fail silently leaving us scratching our heads why suddenly Tentacles don't register anymore.

Kostya

  1. Support Staff 1 Posted by Lawrence Wilson on 23 Jan, 2018 06:23 AM

    Lawrence Wilson's Avatar

    Hi Kostya,
    Thanks for getting in touch! I'm sorry to hear you're seeing issues installing Octopus Tentacle with a machine policy name containing spaces.

    So that I can reproduce this issue, can I please get the version of Octopus Server and Tentacle that you are running, as well as the OctopusDSC version?

    I look forward to hearing from you!

    Kind regards,
    Lawrence.

  2. 2 Posted by konstantine on 23 Jan, 2018 06:43 AM

    konstantine's Avatar

    Octopus Server, Tentacle and OctopusDSC versions are all latest as of today. Looking at OctopusDSC source code I can see that it actually cannot handle ANY parameter if it contains spaces (when it builds command line it does not wrap parameters with double quotes), but only for Machine Policy it become critical, because default one is called "Default Machine Policy" (with spaces) and OctopusDSC fails to register Tentacle with the server when policy is named like that. No error can be seen in any log - registration fails silently and it is hard to debug.

  3. Support Staff 3 Posted by Lawrence Wilson on 24 Jan, 2018 05:15 AM

    Lawrence Wilson's Avatar

    Hi Kostya,

    Thanks for keeping in touch and providing us with those details! For your convenience, I have created an issue for this which you can track at our OctopusDSC Github Issues page.

    Hopefully we should be seeing a fix for this one shortly but please feel free to keep up to date on our progress on the github issue.

    I look forward to hearing form you with how this goes.

    Kind regards,
    Lawrence.

  4. Support Staff 4 Posted by Lawrence Wilson on 05 Feb, 2018 08:07 AM

    Lawrence Wilson's Avatar

    Hi Kostya,
    I just wanted to touch base with you regarding this ticket because I have performed further investigation and I discovered that it might be possible that having spaces in your machine policy names should actually have worked.

    I believe we may need to do further investigation on your environment to be sure. I'm interested to know if you have been able to reproduce this issue since logging the ticket and if you need further help with it.

    Kind regards,
    Lawrence.

  5. 5 Posted by konstantine on 07 Feb, 2018 09:04 PM

    konstantine's Avatar

    Lawrence, I had to come out with the workaround for the bug and the workaround looks like this (in the DSC script):
        Policy = '"Clone Machine Policy"'
    (string with spaces wrapped in double quotes and then again in single quotes)

    Problematic source code located here: https://github.com/OctopusDeploy/OctopusDSC/blob/master/OctopusDSC/DSCResources/cTentacleAgent/cTentacleAgent.psm1, line 526:
        $registerArguments += @("--policy", $policy)
    It adds $policy to Tentacle.exe command line without wrapping it with the quotes, so as soon as $policy string contains spaces this statement generates syntactically incorrect command line. It cannot work, but the fix is pretty simple:
        $registerArguments += @("--policy", "$policy")

  6. Support Staff 6 Posted by Lawrence Wilson on 12 Feb, 2018 01:40 AM

    Lawrence Wilson's Avatar

    Hi Kostya,

    Thanks for keeping in touch, I will keep investigating this issue on our end. Please feel free to keep an eye on the Github issue for further updates. Thank you for providing us with your workaround in the meantime.

    Kind Regards,
    Lawrence

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac