コード例 #1
0
ファイル: Spkg.py プロジェクト: psbanka/bombardier
def dumpReport(report, logger):
    "Legacy"
    instance_name = get_instance()
    output_path = make_path(get_spkg_path(), instance_name, "output")
    if not os.path.isdir(output_path):
        os.makedirs(output_path)
    script_name = sys.argv[-1].split(".py")[0]
    output_file = "%s-output.yml" % script_name
    dump_string = yaml_dump(report)
    open(make_path(output_path, output_file), 'w').write(dump_string)
    for line in dump_string.split('\n'):
        logger.info("==REPORT==:%s" % line)
コード例 #2
0
ファイル: Config.py プロジェクト: psbanka/bombardier
 def save_hash(self, path):
     """
     Save off a hash of our config data for future reference
     path -- the place to find the configuration hash that was used the
             last time this package was configured or installed
     """
     try:
         file_handle = open(path, "w")
         hash_dict = hash_dictionary(self.data)
         dump_str = yaml_dump(hash_dict)
         file_handle.write(dump_str)
         file_handle.close()
     except IOError:
         return FAIL
     return OK
コード例 #3
0
ファイル: Spkg.py プロジェクト: psbanka/bombardier
 def _dump_report(self, report = None):
     '''
     report -- a dictionary of the data that was generated
     For a command that was run on an spkg class, this provides
     data back to the CNM 
     '''
     if type(report) != type({}):
         report = self.report
     command = inspect.stack()[2][3]
     output_path = make_path(get_spkg_path(), self.instance_name, "output")
     if not os.path.isdir(output_path):
         os.makedirs(output_path)
     output_file = "%s-output.yml" % command
     dump_string = yaml_dump(report)
     open(make_path(output_path, output_file), 'w').write(dump_string)
     for line in dump_string.split('\n'):
         Logger.info("==REPORT==:%s" % line)
コード例 #4
0
ファイル: Progress.py プロジェクト: psbanka/bombardier
 def update_progress(self, dictionary, overwrite=False):
     "updates package status information"
     return_status = OK
     tmp_path = tempfile.mkstemp()[1]
     data = self.load_current_progress()
     try:
         int_data = integrate(data, dictionary, overwrite)
         dump_string = yaml_dump(int_data)
         file_handle = open(tmp_path, 'w')
         file_handle.write(dump_string)
         file_handle.flush()
         file_handle.close()
         del file_handle
         shutil.copy(tmp_path, self.progress_path)
         #os.unlink(tmp_path)
     except IOError:
         return_status = FAIL
     except StatusException:
         return_status = FAIL
     os.system('bash -c "rm -rf %s"' % tmp_path)
     return return_status
コード例 #5
0
ファイル: FileManifest.py プロジェクト: psbanka/bombardier
 def write_manifest_file(self):
     """Write out the json or yaml for the manifest to the expected path"""
     dump_string = yaml_dump( self.manifest_dictionary )
     handle = open( self.manifest_path, "w" )
     handle.write( dump_string )
     handle.close()