Merge ~ycheng-twn/pc-enablement/+git/oem-scripts:0001_launchpad_api_handy into ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master

Proposed by Yuan-Chen Cheng
Status: Merged
Merged at revision: 6d29cd035e7885fbf087394b440007fe4987b24c
Proposed branch: ~ycheng-twn/pc-enablement/+git/oem-scripts:0001_launchpad_api_handy
Merge into: ~oem-solutions-engineers/pc-enablement/+git/oem-scripts:master
Diff against target: 76 lines (+38/-1)
2 files modified
debian/changelog (+6/-0)
launchpad-api (+32/-1)
Reviewer Review Type Date Requested Status
Shih-Yuan Lee Approve
Review via email: mp+404278@code.launchpad.net

Commit message

launchpad-api: refine message and add handy test

To post a comment you must log in.
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

+ cat output/oem-scripts-0.99-1f89055-in-docker-focal-summary.log
autopkgtest-collect-credentials PASS
autopkgtest-oem-scripts-auto PASS
pkg-somerville-meta PASS
pkg-stella-meta PASS
pkg-sutton-meta PASS
bug-bind PASS
get-private-ppa PASS
jq-lp PASS
launchpad-api PASS
lp-bug PASS
oem-meta-packages PASS
pkg-list PASS
review-merge-proposal PASS
run-autopkgtest PASS
setup-apt-dir PASS
mir-bug SKIP exit status 77 and marked as skippable
git-url-insteadof-setting PASS
recovery-from-iso.sh PASS
mir-bug-verification PASS

Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

Please use "Here Documents" instead.

review: Needs Fixing
Revision history for this message
Shih-Yuan Lee (fourdollars) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index a693a9a..378680c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1oem-scripts (0.99) UNRELEASED; urgency=medium
2
3 * launchpad-api: refine message and add handy test.
4
5 -- Yuan-Chen Cheng <yc.cheng@canonical.com> Fri, 04 Jun 2021 13:00:53 +0800
6
1oem-scripts (0.98) focal; urgency=medium7oem-scripts (0.98) focal; urgency=medium
28
3 * Black all Python files.9 * Black all Python files.
diff --git a/launchpad-api b/launchpad-api
index d812b8f..aa4001e 100755
--- a/launchpad-api
+++ b/launchpad-api
@@ -23,6 +23,33 @@ fi
23LAUNCHPAD_URL="${LAUNCHPAD_URL:=https://launchpad.net}"23LAUNCHPAD_URL="${LAUNCHPAD_URL:=https://launchpad.net}"
24LAUNCHPAD_API="${LAUNCHPAD_API:=https://api.launchpad.net/}"24LAUNCHPAD_API="${LAUNCHPAD_API:=https://api.launchpad.net/}"
2525
26usage_auth_failed()
27{
28 >&2 cat <<EOF
29=== Failure as accessing the web service.
30
31It could be command error OR your authentication token is removed or expired.
32If you think it's the authentication issue, you can try to backup/remove
33the config.ini, get authentication token and try again.
34
35Ex:
36
37 $ mv ~/.config/oem-scripts/config.ini ~/.config/oem-scripts/config.ini.backup
38 $ launchpad-api get devel/people/+me
39 $ # try your command after reset token by using above commands.
40
41EOF
42}
43
44usage()
45{
46 >&2 cat <<EOF
47=== Useage:
48 $ launchpad-api get devel/people/+me # same as "launchpad-api test"
49 $ launchpad-api get devel/people/+me ws.op==getArchiveSubscriptionURLs
50EOF
51}
52
26get_token()53get_token()
27{54{
28 [ "x$debug" = "x1" ] && echo "oauth_consumer_key=${oauth_consumer_key}"55 [ "x$debug" = "x1" ] && echo "oauth_consumer_key=${oauth_consumer_key}"
@@ -97,7 +124,7 @@ get_api()
97 oauth_timestamp=="$(date +%s)" \124 oauth_timestamp=="$(date +%s)" \
98 oauth_token=="${oauth_token}" \125 oauth_token=="${oauth_token}" \
99 oauth_version=="1.0" \126 oauth_version=="1.0" \
100 "$@"127 "$@" || ( usage_auth_failed ; usage )
101}128}
102129
103patch_api()130patch_api()
@@ -162,10 +189,14 @@ case "$1" in
162 shift189 shift
163 post_api "$@"190 post_api "$@"
164 ;;191 ;;
192 ("test")
193 get_api devel/people/+me
194 ;;
165 ("debug")195 ("debug")
166 debug=1196 debug=1
167 get_api devel/people/+me197 get_api devel/people/+me
168 ;;198 ;;
169 (*)199 (*)
200 usage
170 ;;201 ;;
171esac202esac

Subscribers

People subscribed via source and target branches