# Salt Caller floscript

house caller

framer callerroadstack be active first setup
    # Begin the pre-flight checks
    frame setup
        enter
            do salt raet cleanup
            do salt raet road stack setup per inode ".salt.road.manor"
            do salt raet manor lane setup
        go loadmodules

    # Load the minion mods
    frame loadmodules
        do salt load modules at enter
        go start

    # OK, let's start the minion up
    frame start
        # Start the inbound framer
        bid start inbound
        # Start the bootstrap framer
        bid start bootstrap
        # Start the eventing framer
        bid start eventing
        # Start the outbound framer
        bid start outbound

        # Cleanup on exit
        exit
            do salt raet road stack closer per inode ".salt.road.manor."
            do salt raet lane stack closer per inode ".salt.lane.manor."


framer inbound be inactive first start
    frame start
        do salt raet road stack service rx
        do salt raet lane stack service rx


framer bootstrap be inactive first setup

    frame setup
        enter
            do salt raet road clustered per inode ".salt.road.manor."
            do salt raet road usher minion setup per inode ".salt.road.manor."
        go clustermaster
        go multimaster

    frame clustermaster
        let if salt.road.manor.cluster.clustered
        print Setting Up Master Cluster ....
        go join

    frame multimaster
        print Setting Up Master or MultiMaster
        go join

    frame join
        print Joining...
        enter
            do salt raet road stack joiner per inode ".salt.road.manor."
        recur
            do salt raet road stack joined per inode ".salt.road.manor."
            do salt raet road stack rejected per inode ".salt.road.manor."

        go next if joined in .salt.road.manor.status
        go abort if rejected in .salt.road.manor.status

    frame joined
        print Joined
        go next if elapsed >= 0.5

    frame allow
        print Allowing...
        enter
            do salt raet road stack allower per inode ".salt.road.manor."
        recur
            do salt raet road stack allowed per inode ".salt.road.manor."

        go next if allowed in .salt.road.manor.status
        #go abort if elapsed >= 5

    frame allowed
        print Allowed
        go next if elapsed >= 0.5

    frame clustering
        print Cluster Setup ...
        do salt raet road cluster load setup
        go next

    frame manager
        # start the manager framer
        bid start manager #start alive presence from minion side
        go next if elapsed >= 3.0

    frame loading
        print Loading
        enter
            do salt load modules
        go router

    frame router
        do salt raet router minion

    frame abort
        bid stop all

framer eventing be inactive first event
    frame event
        do salt raet eventer

framer manager be inactive first start at 10.0
    frame start
         do salt raet road stack manager per inode ".salt.road.manor"

framer outbound be inactive first start
    frame start
        do salt raet lane stack service tx
        do salt raet road stack service tx

