Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Otter 3 - Error This operation is only valid when run against an SSH agent.



  • Hi
    I have some error when I tried to run some Otterv2 working scripts on Otter 3 😠

    Define a server (as SSH Agent Type) : VM111021
    Create an Otter Module called AnsiblePlaybook

    ##AH:UseTextMode
    module AnsiblePlayBook<$PLAYBOOK = $Tolower($ApplicationName), %EXTRAVARS = %(env:$ToLower($PipelineStageName)), $YML = main.yml, $RQUIRE = requirements.yml, $Branch = master, $Role = OUI, $GitGroupe = ansible/playbooks>
    {
        Log-Debug PLAYBOOK = $PLAYBOOK;
        Log-Debug Role = $Role;
        set %EXTRAVARS = %MapAdd(%EXTRAVARS, v, 0);
        set $DOSSIER = /tmp/ANSIBLE/$PLAYBOOK;
        set $EXTRAFILE = $DOSSIER/extravars.json;
        Log-Debug ******** $ToJson(%EXTRAVARS);
        Ensure-Directory $DOSSIER
        (
            Exists: false
        );
        Log-Debug BEFORE;
        SHExec git config --global http.sslVerify false;
        Log-Debug AFTER;
     if false   
    {
    # Other stuff I would like to run
    }
    }
    

    Create an Otter Plan called Create-NewVM

    ##AH:UseTextMode
    ##AH:Description Deploiement d'une VM à partird'un template
    set $NbVM=1;
    set $YML=create-linux.yml
    set $octet2 = 100;
    set $octet3 = 10;
    set $template = GI-DCS-UBUNTU-20.04.1-20210121;
    set $annotation = $Date - Creation de la VM  / Template : $template;
    # Création d'un VM Linux
    for server VM111021
    {
        # Loop
        foreach $VM in @Range(1, $NbVM)
        {
            call AnsiblePlayBook
            (
                PLAYBOOK: vmware,
                EXTRAVARS: %(octet2:$octet2,octet3:$octet3,template:$template,annotation:$annotation'),
                YML: $YML,
                Role: NON
            );
        }
    }
    

    This script is working fine on Otter 2 but on Otter 3 ...

    DEBUG: 2021-05-03 16:19:28Z - Job will be run against servers sequentially (not asynchronously).
    DEBUG: 2021-05-03 16:19:28Z - Targeting servers: VM111021
    DEBUG: 2021-05-03 16:19:28Z - Beginning execution run...
    DEBUG: 2021-05-03 16:19:28Z - PLAYBOOK = vmware
    DEBUG: 2021-05-03 16:19:28Z - Role = NON
    DEBUG: 2021-05-03 16:19:28Z - ******** {"octet2":"100","octet3":"10","template":"GI-DCS-UBUNTU-20.04.1-20210121","annotation":"2021-05-03T18:19:28 - Creation de la VM  / Template : GI-DCS-UBUNTU-20.04.1-20210121'","v":"0"}
    DEBUG: 2021-05-03 16:19:28Z - Looking for /tmp/ANSIBLE/vmware...
    DEBUG: 2021-05-03 16:19:29Z - Directory does not exist.
    DEBUG: 2021-05-03 16:19:29Z - BEFORE
    ERROR: 2021-05-03 16:19:29Z - This operation is only valid when run against an SSH agent.
    DEBUG: 2021-05-03 16:19:29Z - Script exited with code: 0
    ERROR: 2021-05-03 16:19:29Z - Execution run failed.
    DEBUG: 2021-05-03 16:19:29Z - Cleaning up temporary files on Linux/SSH (10.100.111.21:22)...

  • inedo-engineer

    Hello,

    I'm not able to reproduce this case at all 😢

    The message "This operation is only valid when run against an SSH agent." is logged if you try to run SHEXec against a non-linux server, and I can consistently reproduce that.

    But when I switch to an SSH server, it works totally fine...

    I wonder if there's something simpler at play, like the wrong $ServerName is in context or something? Nothing seems thtat way from the codes you shared, but.... can you try a very simple repro case, like an OtterScript that looks like....

    for server myLinuxServer
    {
        SHExec echo hello world;
    }
    

    Thanks,
    Alana



  • @atripp said in Otter 3 - Error This operation is only valid when run against an SSH agent.:

    I have made a test.
    I also made a Configuration Plan (Ensure Directory which works).

    for server VM111021
    {
        SHExec echo hello world;
    }
    

    e67f1995-a8cd-4a8e-a1b8-075380d6a2ec-image.png

    efb6744b-e42b-4643-93c2-743f2014dab2-image.png

    03e377a5-c327-4561-8b30-fbd8c8175841-image.png



  • @atripp
    Hi,
    I have made a second test with a second Linux Server with the same result
    6eee0118-0a4c-470c-987c-5472b31139fa-image.png


  • inedo-engineer

    FYI; we're going to investigate this some more, and will try to see why it's happeing here, but not for me🙄




  • inedo-engineer

    We've got a fix for this as OT-415. It will be included in Otter v3.0.6. If you'd like, I can publish a prerelease version for you. Thank you!



  • @gdivis
    Oh thanks but I will wait for the release.I won't have so much time to test the week.



  • @gdivis
    Thanks for the resolution


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation