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!

    False and True as string

    Scheduled Pinned Locked Moved Support
    otterpowershell
    7 Posts 4 Posters 39 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.
    • ? This user is from outside of this forum
      Guest
      last edited by

      Hi,
      I need to pass the "False" string to the DSC resource, but it looks like it's being converted to Boolean.

      This is my code:

      Ensure-DscResource
      (
          ConfigurationKey: Name,
          Name: FirewallProfile,
          Module: NetworkingDsc,
          Properties: %(
                  Name: Domain,
                  Enabled: False
                  )
      );
      

      And this is the error:

      ERROR: Convert property 'Enabled' value from type 'BOOLEAN' to type 'STRING' failed
       At line:9, char:2
       Buffer:
      
          Name = "Domain";
      };^
      
      insta
      

      Is it possible to pass False or True as a string?

      Product: Otter
      Version: 2.2.2

      1 Reply Last reply Reply Quote 0
      • jjonesJ Offline
        jjones inedo-engineer
        last edited by

        Hi Adam,

        Do you have the latest version of the Windows extension installed? We had a similar issue for integers that was resolved in the latest extension.

        Thanks,
        Jason

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          Hi Jason,
          Yes, I currently have version 1.0.15 installed.

          Thanks,
          Adam

          1 Reply Last reply Reply Quote 0
          • jjonesJ Offline
            jjones inedo-engineer
            last edited by

            Hi Adam,

            Can you confirm if using false (lowercase) works or not. That is how the sample documentation shows a boolean. I'm also curious if it would convert a zero to false. Let me know what you find out. We may need to make a small change or at least adjust the documentation.

            Thanks,
            Jason

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              Hi,
              using false (lowercase) does not work, I get the same error as above.
              For zero I get:

              ERROR: Convert property 'Enabled' value from type 'SINT64' to type 'STRING' failed
               At line:9, char:2
               Buffer:
              
                  Name = "Public";
              };^
              
              insta
              

              Thanks,
              Adam

              1 Reply Last reply Reply Quote 0
              • P Offline
                pcamelio_0469
                last edited by

                Hello

                Look at :
                Add explicit cast syntax for marshalling values from OtterScript to PowerShell

                This should work for you :

                Enabled:[type:string]False

                Here is an exemple which works for me and which similar of your pb:

                Exemple

                    Ensure-DscResource
                    (
                        Name: Carbon_FirewallRule,
                        Module: Carbon,
                        Properties: %(Name:FWRule-MetaAnnuaire-EXP-50100,Action:Allow,Direction:In,Protocol:tcp,LocalPort:[type::string]50100,Ensure:Present,Profile:Domain)
                    );
                

                Hope this help

                For Inedo's people who read this thread, please update your doc with the github info, so it will be easier to use this nice feature.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thoven
                  last edited by

                  Thanks Philipe; all operation documentation is automatically updated within the software once the latest version of the relevant extension is installed (i.e. the Windows extension in this case). The documentation on the website will also get updated with any minor version of the software is released, or the Inedo.SDK is updated.

                  Hope this helps,
                  -Tod

                  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