From 6b88d4a0dcdff045d164de501dca57aae4c0303c Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Thu, 30 Jun 2016 13:53:37 +0800 Subject: [PATCH 1/2] fix #450 --- utils/registry/repository.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/registry/repository.go b/utils/registry/repository.go index ac49e04f8..84c22c741 100644 --- a/utils/registry/repository.go +++ b/utils/registry/repository.go @@ -99,6 +99,9 @@ func NewRepositoryWithUsername(name, endpoint, username string) (*Repository, er } client, err := newClient(endpoint, username, nil, "repository", name, "pull", "push") + if err != nil { + return nil, err + } repository := &Repository{ Name: name, From 87f51bc12f8301e10d65bd1439c302929028af03 Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Thu, 30 Jun 2016 14:05:34 +0800 Subject: [PATCH 2/2] clean up code under jobservice/ --- .gitignore | 6 ++++++ jobservice/error.json | 10 ---------- jobservice/my_start.sh | 12 ------------ jobservice/populate.sql | 4 ---- jobservice/start_db.sh | 7 ------- jobservice/stop.json | 4 ---- jobservice/sync_policy.json | 1 - jobservice/sync_repo.json | 1 - jobservice/test.json | 17 ----------------- 9 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 jobservice/error.json delete mode 100755 jobservice/my_start.sh delete mode 100644 jobservice/populate.sql delete mode 100755 jobservice/start_db.sh delete mode 100644 jobservice/stop.json delete mode 100644 jobservice/sync_policy.json delete mode 100644 jobservice/sync_repo.json delete mode 100644 jobservice/test.json diff --git a/.gitignore b/.gitignore index 906c9c7cd..8251fd4cd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,9 @@ Deploy/config/db/env Deploy/config/jobservice/env ui/ui *.pyc +jobservice/*.sql +jobservice/*.sh +jobservice/*.json +jobservice/jobservice + + diff --git a/jobservice/error.json b/jobservice/error.json deleted file mode 100644 index 3db697999..000000000 --- a/jobservice/error.json +++ /dev/null @@ -1,10 +0,0 @@ -{ -"job_type": "notexist", -"options": { - "whatever": "whatever" - }, -"parms": { - "test": "test" - }, -"cron_str": "" -} diff --git a/jobservice/my_start.sh b/jobservice/my_start.sh deleted file mode 100755 index 9ef3fea25..000000000 --- a/jobservice/my_start.sh +++ /dev/null @@ -1,12 +0,0 @@ -export MYSQL_HOST=127.0.0.1 -export MYSQL_PORT=3306 -export MYSQL_USR=root -export MYSQL_PWD=root123 -export LOG_LEVEL=debug -export LOCAL_HARBOR_URL=http://127.0.0.1/ -export UI_SECRET=abcdef -#export UI_USR=admin -#export UI_PWD=Harbor12345 -export MAX_JOB_WORKERS=1 - -./jobservice diff --git a/jobservice/populate.sql b/jobservice/populate.sql deleted file mode 100644 index 4cb43fb5d..000000000 --- a/jobservice/populate.sql +++ /dev/null @@ -1,4 +0,0 @@ -use registry; -insert into replication_target (name, url, username, password) values ('test', 'http://10.117.171.31', 'admin', 'Harbor12345'); -insert into replication_policy (name, project_id, target_id, enabled, start_time) value ('test_policy', 1, 1, 1, NOW()); -insert into replication_job (status, policy_id, repository, operation) value ('running', 1, 'library/whatever', 'transfer') diff --git a/jobservice/start_db.sh b/jobservice/start_db.sh deleted file mode 100755 index 686173325..000000000 --- a/jobservice/start_db.sh +++ /dev/null @@ -1,7 +0,0 @@ -#export MYQL_ROOT_PASSWORD=root123 -docker run --name harbor_mysql -d -e MYSQL_ROOT_PASSWORD=root123 -p 3306:3306 -v /devdata/database:/var/lib/mysql harbor/mysql:dev - -echo "sleep 10 seconds..." -sleep 10 - -mysql -h 127.0.0.1 -uroot -proot123 < ./populate.sql diff --git a/jobservice/stop.json b/jobservice/stop.json deleted file mode 100644 index 3f43e37da..000000000 --- a/jobservice/stop.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "policy_id":1, - "action":"stop" -} diff --git a/jobservice/sync_policy.json b/jobservice/sync_policy.json deleted file mode 100644 index 9a40fa461..000000000 --- a/jobservice/sync_policy.json +++ /dev/null @@ -1 +0,0 @@ -{"policy_id": 1} diff --git a/jobservice/sync_repo.json b/jobservice/sync_repo.json deleted file mode 100644 index e2e779415..000000000 --- a/jobservice/sync_repo.json +++ /dev/null @@ -1 +0,0 @@ -{"policy_id": 1, "repository":"library/ubuntu", "tags":["12.04","11.11"]} diff --git a/jobservice/test.json b/jobservice/test.json deleted file mode 100644 index 2a5083d89..000000000 --- a/jobservice/test.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "job_type": "transfer_img_out", - "options": { - "whatever": "whatever" - }, - "parms": { - "secret": "mysecret", - "image": "ubuntu", - "targets": [{ - "url": "127.0.0.1:5000", - "username": "admin", - "password": "admin" - }] - - }, - "cron_str": "" -}