Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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 - Variable at environnement level not found

    Scheduled Pinned Locked Moved Support
    7 Posts 2 Posters 14 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by philippe.camelio_3885

      Hello
      I have a small problem.
      If a variable is assigned at the environment level, it is not available for the Plan
      If the variable is moved at the Role level, the plan is working fine.

      • Otter 3.0.5 -

      Test Case:

      • Environment : INTEGRATION
      • Role: SQL
      • Variable:
      {
        "SQLInstanceParams": "%(BOFINT: %(RAM: 2048, StaticPorts: @(1451, 5022)))"
      }
      
      • Otter Plan: SQL-000-PrepDeploy
      ##AH:UseTextMode
      for role SQL
      {
          # Loop
          foreach $SQLInstance in @SQLInstances
          {
              Log-Debug $SQLInstance;
              # SQL - Firewall - Gestion des ports
              set @StaticPorts = %SQLInstanceParams[$SQLInstance].StaticPorts;
      
              # Loop
              foreach $Port in @StaticPorts
              {
                  set $Name = FW-SQL-${SQLInstance}-${Port};
                  {
                      Firewall::Ensure-NetFirewallRule
                      (
                          Name: $Name,
                          Profiles: "Domain,Private",
                          Port: $Port,
                          Protocol: TCP,
                          Inbound: true,
                          Allow: true,
                          Exists: true
                      );
                  }
              }
          }
      }
      

      When the variable %SQLInstanceParams is defined in the Environnement INTEGRATION, I have this error msg:

      ....
      DEBUG: 2021-04-24 16:08:55Z - Beginning execution run...
      DEBUG: 2021-04-24 16:08:55Z - Looking for firewall rule "FW-SQL-Browser-1434"...
      DEBUG: 2021-04-24 16:08:55Z - Creating new "FW-SQL-Browser-1434" firewall rule...
      DEBUG: 2021-04-24 16:08:55Z - BOFINT
      ERROR: 2021-04-24 16:08:55Z - Could not resolve variable %SQLInstanceParams.
      ERROR: 2021-04-24 16:08:55Z - Execution run failed.
      ...
      

      whereas if the variable %SQLInstanceParams is defined in the role SQL, it is working fine

      DEBUG: 2021-04-24 16:09:58Z - Beginning execution run...
      DEBUG: 2021-04-24 16:09:58Z - Looking for firewall rule "FW-SQL-Browser-1434"...
      DEBUG: 2021-04-24 16:09:58Z - Deleting existing "FW-SQL-Browser-1434" firewall rule...
      DEBUG: 2021-04-24 16:09:58Z - Creating new "FW-SQL-Browser-1434" firewall rule...
      DEBUG: 2021-04-24 16:09:58Z - BOFINT
      DEBUG: 2021-04-24 16:09:58Z - Looking for firewall rule "FW-SQL-BOFINT-1451"...
      DEBUG: 2021-04-24 16:09:58Z - Creating new "FW-SQL-BOFINT-1451" firewall rule...
      DEBUG: 2021-04-24 16:09:58Z - Looking for firewall rule "FW-SQL-BOFINT-5022"...
      DEBUG: 2021-04-24 16:09:58Z - Deleting existing "FW-SQL-BOFINT-5022" firewall rule...
      DEBUG: 2021-04-24 16:09:58Z - Creating new "FW-SQL-BOFINT-5022" firewall rule...
      INFO : 2021-04-24 16:09:58Z - Execution run succeeded.
      
      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        Hmmm... I did a quick test for environment-scoped variable resolution, and it seems to work fine for me, but it seems like it can get a bit complex with nested environments and multiple so there might be a bug

        Is "INTEGRATION" a nested environment? How many environments is your server in?

        Thanks!

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885 @atripp
          last edited by

          @atripp
          INTEGRATION is not a nested environment.
          I have only few environment withe 2 nested env (under DEVELOPPEMENT)
          |-INTEGRATION
          |-DEVELOPPEMENT
          |------RECETTE
          |----- PREPROD
          |-PRODUCTION

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @philippe.camelio_3885
            last edited by

            @philippe-camelio_3885 thanks!

            How many environments are that server in? Just one environment, or multiple? Can you try it with just one environment, if mutliple?

            If it still doesn't work, then I'd like to try to reproduce it. Can you share your infrastructure json file (Admin > Export Infrastructure? If it's sensitive info, then don't worry -- you can just send to support at inedo dot com (instead of public post), with [QA-568] in the subject? I can fish it out of the box then, and attach to our internal tracker.

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              philippe.camelio_3885 @atripp
              last edited by

              @atripp
              As I wrote, I have few environments and INTEGRATION is not a nested env.
              I send you the the json file.
              Cdt

              atrippA 1 Reply Last reply Reply Quote 0
              • atrippA Offline
                atripp inedo-engineer @philippe.camelio_3885
                last edited by

                @philippe-camelio_3885 I had a chance to look at this a little more closely, but just can't get this to reproduce as a problem. At first, I want to point out that no variable is defined on INTEGRATION.

                  "environments": [
                    {
                      "name": "INTEGRATION",
                      "variables": {}
                    },
                    {
                      "name": "PRODUCTION",
                      "variables": {}
                    },
                    {
                      "name": "DEVELOPPEMENT",
                      "variables": {
                        "SQLInstances": "@(BOFRCT, ITRRCT, XTRRCT)"
                      }
                    }
                  ],
                

                Anyways, I imported your infrastructure (converted everything to localServer), deleted the variable from the role and added to the INTEGRATION.

                On VM008004 (in DEV), I got the expected error: Could not resolve variable %SQLInstanceParams. If I delete the variable (SQLInstances) on the server, that variable is resolved because it's defined in DEV, too.

                OP VM008007 (in INT), I got the (different) expected error: Key StaticPorts not present in the map.

                When I delete @SQLInstances (which is defined on the server), then I get the error "Could not resolve variable @SQLInstances." ecause it's not defined on the environment

                P 1 Reply Last reply Reply Quote 0
                • P Offline
                  philippe.camelio_3885 @atripp
                  last edited by

                  @atripp
                  Oups
                  Sorry about that.
                  I made other tests since I created the thread.
                  The data I send you are not correct
                  I will wait for the 3.0.6 to make a clean test case and update the thread.

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post
                  Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation