226 @@ -132,8 +133,9 @@
227 :return The configuration read from the file as a dictionary.
228 """
229 try:
230 - config = yaml.safe_load(hwpack)
231 - self._set_attributes(config)
232 + with open(hwpack, 'r') as hw:
233 + config = yaml.safe_load(hw)
234 + self._set_attributes(config)
235 return config
236 except yaml.YAMLError, ex:
237 logger.debug("Error loading YAML file %s" % hwpack, ex)
I believe that since we are opening a file inside the with statement, we also need to catch the IOError exception for when the file doesn't exist. Other than that, looks good.
226 @@ -132,8 +133,9 @@ load(hwpack) attributes( config) attributes( config)
227 :return The configuration read from the file as a dictionary.
228 """
229 try:
230 - config = yaml.safe_
231 - self._set_
232 + with open(hwpack, 'r') as hw:
233 + config = yaml.safe_load(hw)
234 + self._set_
235 return config
236 except yaml.YAMLError, ex:
237 logger.debug("Error loading YAML file %s" % hwpack, ex)
I believe that since we are opening a file inside the with statement, we also need to catch the IOError exception for when the file doesn't exist. Other than that, looks good.