Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
resource-agents
0024-Medium-aws-vpc-route53-Fix-tempfile-race-b...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0024-Medium-aws-vpc-route53-Fix-tempfile-race-bsc-1059312.patch of Package resource-agents
From e660628d816928f61c578f1af334bba51b0ee2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= <krig@koru.se> Date: Mon, 23 Oct 2017 13:59:30 +0200 Subject: [PATCH 24/27] Medium: aws-vpc-route53: Fix tempfile race (bsc#1059312) --- heartbeat/aws-vpc-route53 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/heartbeat/aws-vpc-route53 b/heartbeat/aws-vpc-route53 index d9b6d84b..3c31f6c4 100755 --- a/heartbeat/aws-vpc-route53 +++ b/heartbeat/aws-vpc-route53 @@ -215,7 +215,11 @@ ec2ip_stop() { # Patch file ocf_log debug "function ec2ip_stop: will delete IP address to ${IPADDRESS}" ocf_log info "EC2: Updating Route53 $OCF_RESKEY_hostedzoneid with $IPADDRESS for $OCF_RESKEY_fullname" - ROUTE53RECORD="/var/tmp/route53-${OCF_RESKEY_hostedzoneid}-${IPADDRESS}.json" + ROUTE53RECORD="$(maketempfile)" + if [ $? -ne 0 ] || [ -z "$ROUTE53RECORD" ]; then + ocf_exit_reason "Failed to create temporary file for record update" + exit $OCF_ERR_GENERIC + fi echo "{ " > ${ROUTE53RECORD} echo " \"Comment\": \"Update record to reflect new IP address for a system \", " >> ${ROUTE53RECORD} echo " \"Changes\": [ " >> ${ROUTE53RECORD} @@ -239,7 +243,7 @@ ec2ip_stop() { ocf_log debug "function ec2ip_start: executing command: $cmd" CHANGEID=$($cmd | grep CHANGEINFO | /usr/bin/awk -F'\t' '{ print $3 }' ) ocf_log debug "Change id: ${CHANGEID}" - rm ${ROUTE53RECORD} + rmtempfile ${ROUTE53RECORD} CHANGEID=$(echo $CHANGEID |cut -d'/' -f 3 |cut -d'"' -f 1 ) ocf_log debug "Change id: ${CHANGEID}" STATUS="PENDING" @@ -262,7 +266,11 @@ ec2ip_start() { # Patch file ocf_log debug "function ec2ip_start: will update IP address to ${IPADDRESS}" ocf_log info "EC2: Updating Route53 $OCF_RESKEY_hostedzoneid with $IPADDRESS for $OCF_RESKEY_fullname" - ROUTE53RECORD="/var/tmp/route53-${OCF_RESKEY_hostedzoneid}-${IPADDRESS}.json" + ROUTE53RECORD="$(maketempfile)" + if [ $? -ne 0 ] || [ -z "$ROUTE53RECORD" ]; then + ocf_exit_reason "Failed to create temporary file for record update" + exit $OCF_ERR_GENERIC + fi echo "{ " > ${ROUTE53RECORD} echo " \"Comment\": \"Update record to reflect new IP address for a system \", " >> ${ROUTE53RECORD} echo " \"Changes\": [ " >> ${ROUTE53RECORD} @@ -286,7 +294,7 @@ ec2ip_start() { ocf_log debug "function ec2ip_start: executing command: $cmd" CHANGEID=$($cmd | grep CHANGEINFO | /usr/bin/awk -F'\t' '{ print $3 }' ) ocf_log debug "Change id: ${CHANGEID}" - rm ${ROUTE53RECORD} + rmtempfile ${ROUTE53RECORD} CHANGEID=$(echo $CHANGEID |cut -d'/' -f 3 |cut -d'"' -f 1 ) ocf_log debug "Change id: ${CHANGEID}" STATUS="PENDING" -- 2.15.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor