Bug report: Amster variable substitution

Tagged: , ,

This topic has 1 reply, 1 voice, and was last updated 1 week ago by soma.

  • Author
    Posts
  • #28689
     soma
    Participant

    I have the following *.amster file:

    amServerUrl = System.getenv("AM_SERVER_URL")
    amHome = System.getenv("OPENAM_HOME")
    
    connect \
        --private-key amHome/security/keys/amster/amster_rsa \
        amServerUrl
    
    import-config \
        --path amHome/openam-tools/amster/export/openam.example.com \
        --clean true \
        --failOnError true
    
    :exit

    Result:

    Amster OpenAM Shell (7.1.0 build 4e72fe392c000b0a15027eb41267d01bfd2d2220, JVM: 11.0.12)
    Type ':help' or ':h' for help.
    -------------------------------------------------------------------------------
    am> :load /root/openam/openam-tools/amster/openam-realm-configuration.amster
    ===> true
    ===> https://openam.example.com:8443/openam
    ===> /root/openam
    Could not connect to OpenAM server at https://openam.example.com:8443/openam
    Reason: Could not find the private key file: amHome/security/keys/amster/amster_rsa
    No connection to OpenAM found. Please connect to an OpenAM instance.

    The defined amHomevariable is recognized in the --private-key param.

    I am new in the OpenAM 7.1 world. What I do not understand is I do not see the reason why you guys do not use the standard bash variable syntax for variables ($).

    Really hard to read this script because you have no idea whether the word is a “simple text” or a “variable” in the script. This is a really bad concept to use variables that way in your *.amster script file.

    This one works fine:

    amPassword = System.getenv("AM_ADMIN_PASSWORD")
    amCookieDomain = System.getenv("AM_COOKIE_DOMAIN")
    amServerUrl = System.getenv("AM_SERVER_URL")
    
    install-openam \
     --acceptLicense \
     --serverUrl amServerUrl \
     --cookieDomain amCookieDomain \
     --adminPwd amPassword
    • This topic was modified 1 week ago by soma.
    #28691
     soma
    Participant

    workaround:

    sed -i "s~amHome/~$OPENAM_HOME/~g" $OPENAM_HOME/openam-tools/amster/openam-realm-configuration.amster
    $OPENAM_HOME/openam-tools/amster/amster $OPENAM_HOME/openam-tools/amster/openam-realm-configuration.amster

    The SED operation must be removed from the bash script once this bug is fixed.

    • This reply was modified 1 week ago by soma.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

©2021 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?