Add --insecure/-k option to cfn-signal

cfn-signal will not work when heat-cfn-api server is configured
for the https. This patch will provide a option to make a insecure
request to the cfn server.

Change-Id: I9dcd53b40a389811e292c331ff625a8b5af827b7
Closes-Bug: 1460007
This commit is contained in:
tyagi 2015-05-29 03:37:18 -07:00
parent 02acffbe2a
commit 791046046e
1 changed files with 9 additions and 2 deletions

View File

@ -57,6 +57,9 @@ parser.add_argument('--exit',
required=False)
parser.add_argument('url',
help='the url to post to')
parser.add_argument('-k', '--insecure',
help="This will make insecure https request to cfn-api.",
action='store_true')
args = parser.parse_args()
log_format = '%(levelname)s [%(asctime)s] %(message)s'
@ -98,8 +101,12 @@ body = {
"Data": args.data
}
cmd_str = "curl -X PUT -H \'Content-Type:\' --data-binary \'%s\' \"%s\"" % \
(cfn_helper.json.dumps(body), args.url)
insecure = ""
if args.insecure:
insecure = "--insecure"
cmd_str = ("curl %s -X PUT -H \'Content-Type:\' --data-binary \'%s\' \"%s\"" %
(insecure, cfn_helper.json.dumps(body), args.url))
command = cfn_helper.CommandRunner(cmd_str).run()
if command.status != 0:
LOG.error(command.stderr)