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



  • 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


  • inedo-engineer

    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



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

    Thanks,
    Adam


  • inedo-engineer

    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



  • 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



  • 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.



  • 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



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation