Merge lp:~sseman/juju-ci-tools/resource-2 into lp:juju-ci-tools/repository

Proposed by Seman
Status: Merged
Merged at revision: 43
Proposed branch: lp:~sseman/juju-ci-tools/resource-2
Merge into: lp:juju-ci-tools/repository
Diff against target: 54 lines (+14/-6)
3 files modified
charms/dummy-resource/baz.txt (+1/-0)
charms/dummy-resource/hooks/config-changed (+6/-3)
charms/dummy-resource/hooks/install (+7/-3)
To merge this branch: bzr merge lp:~sseman/juju-ci-tools/resource-2
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+295608@code.launchpad.net

Description of the change

Updated the charm to add more info about the resource file. Added file path, total time it took to download and size of the file the unit is downloading.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'charms/dummy-resource/baz.txt'
2--- charms/dummy-resource/baz.txt 1970-01-01 00:00:00 +0000
3+++ charms/dummy-resource/baz.txt 2016-05-24 17:07:51 +0000
4@@ -0,0 +1,1 @@
5+There is baz in this file.
6
7=== modified file 'charms/dummy-resource/hooks/config-changed'
8--- charms/dummy-resource/hooks/config-changed 2016-05-19 04:18:16 +0000
9+++ charms/dummy-resource/hooks/config-changed 2016-05-24 17:07:51 +0000
10@@ -1,6 +1,9 @@
11 #!/bin/bash
12
13+set -x
14 RES_NAME="bar"
15+
16+START_TIME=$(date +%s)
17 RES_PATH=$(2>&1 resource-get $RES_NAME)
18 if [ $? -ne 0 ]; then
19 RES_GET_STDERR=$RES_PATH
20@@ -8,6 +11,6 @@
21 exit 0
22 fi
23
24-set -e
25-status-set maintenance "path: $RES_PATH"
26-#status-set maintenance $(cat $RES_PATH)
27+TOTAL=$(($(date +%s) - $START_TIME))
28+SIZE=$(du -b $RES_PATH | cut -f1)
29+status-set maintenance "Path: $RES_PATH Time: $TOTAL sec Size: $SIZE bytes"
30
31=== modified file 'charms/dummy-resource/hooks/install'
32--- charms/dummy-resource/hooks/install 2016-05-19 04:18:16 +0000
33+++ charms/dummy-resource/hooks/install 2016-05-24 17:07:51 +0000
34@@ -1,6 +1,10 @@
35 #!/bin/bash
36
37+set -x
38+
39 RES_NAME="foo"
40+
41+START_TIME=$(date +%s)
42 RES_PATH=$(2>&1 resource-get $RES_NAME)
43 if [ $? -ne 0 ]; then
44 RES_GET_STDERR=$RES_PATH
45@@ -8,6 +12,6 @@
46 exit 0
47 fi
48
49-set -e
50-status-set maintenance "path: $RES_PATH"
51-#status-set maintenance $(cat $RES_PATH)
52+TOTAL=$(($(date +%s) - $START_TIME))
53+SIZE=$(du -b $RES_PATH | cut -f1)
54+status-set maintenance "Path: $RES_PATH Time: $TOTAL sec Size: $SIZE bytes"

Subscribers

People subscribed via source and target branches