Cloudify REST script

Source: Internet
Author: User
Tags cloudify

Cloudify REST script 01 #! /Bin/bash02 03 bootOutput = "bl. out "04rm-f $ bootOutput // Delete b1.out file 05. /cloudify. sh "bootstrap-cloud ec2"> $ bootOutput 2> & 1 // run. /cloudify. sh bootstrap-cloud ec2 redirects the output to b1.out and standard input to standard output. 06 searchString = "Rest service is" 07 selectedText = 'grep "$ {searchString}" $ bootoutput' // find the line "Rest service is" in b1.out and assign it to selectedText08rawValue = 'echo $ {selectedText} | awk '{print $6} ''// divide the sixth field in selectedText by space or tab) assigned to rawValue09restURL = "$ {rawValue % ?} "// Linux string operation, which is executed after the last character of rawValue is deleted, that is, extract restURL10echo "1st restURL is $ {restURL}" >>$ bootOutput 2> & 1 // print and redirect to b1.out and standard output 11 12 # If there are two management machines (and in production, we recommend it ...), 13 # you'll have two Rest URLs14rawValue = 'echo $ {selectedText} | awk' {print $12} ''// same as above 15rest2URL =" $ {rawValue % ?} "16 echo" 2nd restURL is $ {rest2URL} ">>$ bootOutput 2> & 117 18 # Now set the restURL value in the service context attributes (global scope, 19 # so it'll be available for all applications): 20 # e.g.: set-attributes-scope global '{"restURL": "$ {restURL}", "rest2URL": "$ {rest2URL}"} '21. /cloudify. sh "connect $ {restURL}; set-attributes-scope global '{\" restURL \ ": \" $ {restURL} \ ", \" rest2URL \": \ "$ {rest2URL} \"} '">>$ bootOutput 2> & 1 // connect to the restURL and set the restURL to the global attribute 22 23 # Just checking that it of all applications's there :) 24. /cloudify. sh "connect $ {restURL }; list-attributes ">>$ bootOutput 2> & 1 // test the connection and display all attributes 25 26 # Now you can install any application27 # and access the restURL attribute (or" rest2URL") 28 # e.g.: In a groovy lifecycle event handler: 29 # def restURL = context. attributes. global ["restURL"] 30 #. /cloudify. sh "connect $ {restURL}; install-application PATH_TO_APPLICATION" >>$ bootOutput 2> & 1
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.