[user_data] do not create any file to read user_data, open it directly with urllib2
--- a/others/user_data_parser.py Tue Dec 03 11:25:25 2013 +0100
+++ b/others/user_data_parser.py Thu Dec 05 16:20:04 2013 +0100
@@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
# author: Paul Tonelli <ptonelli@logilab.fr>
-import urllib, os
+import os
+import urllib2
from time import sleep
from salt import grains
from sys import argv
@@ -35,11 +36,10 @@
else: return self.fp.readline()
if __name__ == "__main__":
- os.chdir('/tmp')
if len(argv)>1: #we have a filename, no need to download it
myfile = open(argv[1],'r')
else:
- myfile = open(urllib.urlretrieve(url)[0],'r')
+ myfile = urllib2.urlopen(url)
found_flag = False
while found_flag == False:
line = myfile.readline()