@@ -118,26 +118,47 @@ class Node(object):
118118
119119 @staticmethod
120120 def get_version_from_build (install_dir = None , node_path = None , cassandra = False ):
121+ logger .error (f'INSTALL DIR IS: { install_dir } ' )
122+ logger .error (f'NODE PATH IS: { node_path } ' )
121123 if install_dir is None and node_path is not None :
124+ logger .error (f'conditional 1' )
122125 install_dir = get_install_dir_from_cluster_conf (node_path )
123126 if install_dir is not None :
127+ logger .error (f'conditional 2' )
124128 # hack, nodes can be of a different type to the cluster
125129 node_class = extension .get_cluster_class (install_dir ).getNodeClass ()
126130 if node_class is not Node :
131+ logger .error (f'node class; get: { node_class } ' )
127132 return node_class .get_version_from_build (install_dir , node_path , cassandra )
128133 # Binary cassandra installs will have a 0.version.txt file
129134 version_file = os .path .join (install_dir , '0.version.txt' )
130135 if os .path .exists (version_file ):
136+ logger .error (f'version_file get: { version_file } ' )
131137 with open (version_file ) as f :
132138 return LooseVersion (f .read ().strip ())
133139 # Source cassandra installs we can read from build.xml
134140 build = os .path .join (install_dir , 'build.xml' )
141+ logger .error (f'build.xml path check: [{ build } ]' )
135142 if os .path .exists (build ):
136- with open (build ) as f :
137- for line in f :
138- match = re .search ('name="base\.version" value="([0-9.]+)[^"]*"' , line )
139- if match :
140- return LooseVersion (match .group (1 ))
143+ logger .error ('GET' )
144+ try :
145+ with open (build ) as f :
146+ for line in f :
147+ match = re .search ('name="base\.version" value="([0-9.]+)[^"]*"' , line )
148+ if match :
149+ logger .error (f'GREP: Match on line: { line } . processing group 1: { match .group (1 )} ' )
150+ result = LooseVersion (match .group (1 ))
151+ print (f'RETURNING RESULT: { result } ' )
152+ return result
153+ # return LooseVersion(match.group(1))
154+ logger .error (f'Opened file but did not return.' )
155+ except Exception as e :
156+ logger .error (f'Got an exception trying to parse version from build.xml: { e } ' )
157+ logger .error ('POST GET?' )
158+ else :
159+ logger .error ('No build.xml. We are hosed.' )
160+ else :
161+ logger .error (f'conditions not met.' )
141162 raise common .CCMError ("Cannot find version" )
142163
143164
0 commit comments