Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: freenas/freenas
...
head fork: freenas/freenas
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
4 gui/freeadmin/static/lib/js/freeadmin/Progress.js
View
@@ -75,6 +75,7 @@ define([
update: function(uuid) {
var me = this;
if(uuid) this.uuid = uuid;
+ this.dapMainLabel.innerHTML = this.steps[this._curStep-1].label;
if(this.fileUpload && this._curStep == 1) {
xhr.get('/progress', {
headers: {"X-Progress-ID": me.uuid}
@@ -82,7 +83,6 @@ define([
var obj = eval(data);
if(obj.state == 'uploading') {
var perc = Math.ceil((obj.received / obj.size)*100);
- console.log(perc);
if(perc == 100) {
me._subProgress.update({'indeterminate': true});
me._masterProgress(perc);
@@ -122,7 +122,7 @@ define([
me._curStep = data.step;
}
if(data.percent == 100) {
- me._subProgressr.update({'indeterminate': true});
+ me._subProgress.update({'indeterminate': true});
me._masterProgress(data.percent);
if(me._curStep == me._numSteps)
return;
66 gui/middleware/notifier.py
View
@@ -2324,35 +2324,43 @@ def validate_update(self, path):
self.__system("rm -rf */")
percent = 0
- with open('/tmp/.upgrade_extract', 'w') as f:
- size = os.stat(path).st_size
- proc = subprocess.Popen([
- "/usr/bin/tar",
- "-xJpf",
- path,
- ], stderr=f)
- RE_TAR = re.compile(r"^In: (\d+)", re.M|re.S)
- while True:
- if proc.poll() is not None:
- break
- try:
- os.kill(proc.pid, signal.SIGINFO)
- except:
- break
- time.sleep(1)
- #TODO: We don't need to read the whole file
- with open('/tmp/.upgrade_extract', 'r') as f2:
- line = f2.read()
- reg = RE_TAR.findall(line)
- if reg:
- current = Decimal(reg[-1])
- percent = (current / size ) * 100
- err = proc.communicate()[1]
- if proc.returncode != 0:
- os.chdir('/')
- raise MiddlewareError(
- 'The firmware image is invalid, make sure to use .txz file: %s' % err
- )
+ with open('/tmp/.extract_progress', 'w') as fp:
+ fp.write("2|%d\n" % percent)
+ fp.flush()
+ with open('/tmp/.upgrade_extract', 'w') as f:
+ size = os.stat(path).st_size
+ proc = subprocess.Popen([
+ "/usr/bin/tar",
+ "-xJpf",
+ path,
+ ], stderr=f)
+ RE_TAR = re.compile(r"^In: (\d+)", re.M|re.S)
+ while True:
+ if proc.poll() is not None:
+ break
+ try:
+ os.kill(proc.pid, signal.SIGINFO)
+ except:
+ break
+ time.sleep(1)
+ #TODO: We don't need to read the whole file
+ with open('/tmp/.upgrade_extract', 'r') as f2:
+ line = f2.read()
+ reg = RE_TAR.findall(line)
+ if reg:
+ current = Decimal(reg[-1])
+ percent = (current / size ) * 100
+ fp.write("2|%d\n" % percent)
+ fp.flush()
+ err = proc.communicate()[1]
+ if proc.returncode != 0:
+ os.chdir('/')
+ raise MiddlewareError(
+ 'The firmware image is invalid, make sure to use .txz file: %s' % err
+ )
+ fp.write("3|\n")
+ fp.flush()
+ os.unlink('/tmp/.extract_progress')
try:
subprocess.check_output(
['bin/install_worker.sh', 'pre-install'],

No commit comments for this range

Something went wrong with that request. Please try again.