예제 #1
0
파일: upload.py 프로젝트: jlprevatt-zz/qpc
 def _check_insights_version(self):
     version_command = self.insights_command.version()
     process = subprocess.Popen(version_command,
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE)
     streamdata = format_subprocess_stderr(process)
     code = process.returncode
     version_check = check_insights_version(streamdata,
                                            insights.CLIENT_VERSION,
                                            insights.CORE_VERSION)
     if not version_check['results'] or code != 0:
         if 'client' in version_check.keys():
             print(_(messages.BAD_CLIENT_VERSION %
                     (version_check['client'],
                      insights.CLIENT_VERSION)))
         if 'core' in version_check.keys():
             print(_(messages.BAD_CORE_VERSION %
                     (version_check['core'],
                      insights.CORE_VERSION)))
         if 'error' in version_check.keys():
             print(_(messages.ERROR_INSIGHTS_VERSION %
                     (version_check['error'])))
         print(_(messages.CHECK_VERSION %
                 (' '.join(version_command))))
         sys.exit(1)
예제 #2
0
파일: upload.py 프로젝트: jlprevatt-zz/qpc
 def _check_insights_install(self):
     connection_test_command = self.insights_command.test_connection()
     process = subprocess.Popen(connection_test_command,
                                stderr=subprocess.PIPE)
     streamdata = format_subprocess_stderr(process)
     install_check = check_insights_install(streamdata)
     if not install_check:
         print(_(messages.BAD_INSIGHTS_INSTALL %
                 (' '.join(connection_test_command))))
         sys.exit(1)
예제 #3
0
파일: upload.py 프로젝트: jlprevatt-zz/qpc
    def _upload_to_insights(self):
        upload_command = self.insights_command.upload(self.tmp_tar_name)
        process = subprocess.Popen(upload_command, stderr=subprocess.PIPE)
        streamdata = format_subprocess_stderr(process)
        code = process.returncode
        report_check = check_successful_upload(streamdata)
        print(_(messages.INSIGHTS_UPLOAD_REPORT % self.report_id))
        if not report_check or code != 0:
            print(_(messages.BAD_INSIGHTS_UPLOAD % (self.report_id, (' '.join(upload_command)))))
            os.remove(self.tmp_tar_name)
            sys.exit(1)

        format_streamdata = format_upload_success(streamdata)
        print(_(format_streamdata))
        os.remove(self.tmp_tar_name)