From 8835d5dd8405d3269a6009ebc2bb896c4822e2b5 Mon Sep 17 00:00:00 2001 From: Ernesto Ojeda Date: Wed, 6 Oct 2021 15:26:11 -0700 Subject: [PATCH 01/13] ci: changes required for Jakara LTS Signed-off-by: Ernesto Ojeda Signed-off-by: Mengyi --- .gitignore | 1 - Dockerfile | 4 +- Makefile | 12 +- bin/test-attribution-txt.sh | 6 +- go.sum | 221 ++++++++++++++++++++++++++++++++++++ 5 files changed, 232 insertions(+), 12 deletions(-) create mode 100644 go.sum diff --git a/.gitignore b/.gitignore index 7ad9e65c..d026fdc6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,5 @@ coverage.out vendor/ cmd/device-snmp glide.lock -go.sum VERSION \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5ee58ae2..ee2435a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,9 +27,7 @@ RUN apk add --update --no-cache ${ALPINE_PKG_BASE} ${ALPINE_PKG_EXTRA} WORKDIR /device-snmp-go COPY . . - -RUN go mod tidy -RUN make update +RUN [ ! -d "vendor" ] && go mod download all || echo "skipping..." RUN ${MAKE} diff --git a/Makefile b/Makefile index 7cd59f22..c237ccb9 100644 --- a/Makefile +++ b/Makefile @@ -14,18 +14,19 @@ VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0) GIT_SHA=$(shell git rev-parse HEAD) GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-snmp-go.Version=$(VERSION)" +tidy: + go mod tidy + build: $(MICROSERVICES) cmd/device-snmp: - go mod tidy $(GOCGO) build $(GOFLAGS) -o $@ ./cmd test: - go mod tidy $(GOCGO) test ./... -coverprofile=coverage.out $(GOCGO) vet ./... - gofmt -l . - [ "`gofmt -l .`" = "" ] + gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/") + [ "`gofmt -l $$(find . -type f -name '*.go'| grep -v "/vendor/")`" = "" ] ./bin/test-attribution-txt.sh clean: @@ -45,3 +46,6 @@ docker_device_snmp_go: -t edgexfoundry/device-snmp:$(GIT_SHA) \ -t edgexfoundry/device-snmp:$(VERSION)-dev \ . + +vendor: + $(GO) mod vendor diff --git a/bin/test-attribution-txt.sh b/bin/test-attribution-txt.sh index acedfee3..c173907d 100755 --- a/bin/test-attribution-txt.sh +++ b/bin/test-attribution-txt.sh @@ -14,13 +14,13 @@ if [ -d vendor.bk ]; then exit 1 fi -trap cleanup 1 2 3 6 +trap cleanup 0 1 2 3 6 cleanup() { cd "$GIT_ROOT" # restore the vendor dir - rm -r vendor + rm -rf vendor if [ -d vendor.bk ]; then mv vendor.bk vendor fi @@ -54,5 +54,3 @@ else fi cd "$GIT_ROOT" - -cleanup diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..4aac9f9f --- /dev/null +++ b/go.sum @@ -0,0 +1,221 @@ +bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690 h1:N9r8OBSXAgEUfho3SQtZLY8zo6E1OdOMvelvP22aVFc= +bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690/go.mod h1:Ulb78X89vxKYgdL24HMTiXYHlyHEvruOj1ZPlqeNEZM= +github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= +github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/eclipse/paho.mqtt.golang v1.3.5 h1:sWtmgNxYM9P2sP+xEItMozsR3w0cqZFlqnNN1bdl41Y= +github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= +github.com/edgexfoundry/device-sdk-go/v2 v2.0.0 h1:lUHtBybuyWmZUSH4A+HyEl3YgMsedxWkc0GRnPy9hnQ= +github.com/edgexfoundry/device-sdk-go/v2 v2.0.0/go.mod h1:CDh2Ha/mbtZ+aQ6yThDIEiS3WT1+2/u3Eb0pDXq3N6I= +github.com/edgexfoundry/go-mod-bootstrap/v2 v2.0.0 h1:R/vL/X85fk0rs4LZ8ntYevUxjrL1RYjdmoYlfuhIgvU= +github.com/edgexfoundry/go-mod-bootstrap/v2 v2.0.0/go.mod h1:E5KLeFEwTuIbjrKMCInn7WiObxkMa4JGJsEodMugipE= +github.com/edgexfoundry/go-mod-configuration/v2 v2.0.0 h1:S1rUyJPJWSvlkNHLbHLFWBvqzH+ShO1xPp4HH7Pvn9I= +github.com/edgexfoundry/go-mod-configuration/v2 v2.0.0/go.mod h1:NZnjQtCdQtPH/eoOuTKA+8+FsoUU3WSlZ5JpXWuiYQQ= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0 h1:tvfovdyoHOb392L59hiuA90awiXLX5IR3HOgbcWZkVQ= +github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0/go.mod h1:pfXURRetgIto0GR0sCjDrfa71hqJ1wxmQWi/mOzWfWU= +github.com/edgexfoundry/go-mod-messaging/v2 v2.0.1 h1:8nT3CiPLIft5RmR+vbmXBW9Kbz7TqPZ6C8QuQ6TTn6w= +github.com/edgexfoundry/go-mod-messaging/v2 v2.0.1/go.mod h1:bLKWB9yeOHLZoQtHLZlGwz8MjsMJIvHDFce7CcUb4fE= +github.com/edgexfoundry/go-mod-registry/v2 v2.0.0 h1:FCodcfCo3EqgINbGa9Rn6LqbiwkdT2FPKgCnk81GbFs= +github.com/edgexfoundry/go-mod-registry/v2 v2.0.0/go.mod h1:CrIAHtfD/Pz7OpytV1/961LK3hURp4fnpk4LT2XTF+8= +github.com/edgexfoundry/go-mod-secrets/v2 v2.0.0 h1:l1LNh0uANk0hGtqbCEFsVIPpbDWpXmNNQwVeLLsZVH0= +github.com/edgexfoundry/go-mod-secrets/v2 v2.0.0/go.mod h1:SbTMX0C+uGK7XCQYuD4oHmGSK5cYV/0mZLpLBu9HAmM= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fxamacker/cbor/v2 v2.2.0 h1:6eXqdDDe588rSYAi1HfZKbx6YYQO4mxQ9eC6xYpU/JQ= +github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.6.1 h1:W6TRDXt4WcWp4c4nf/G+6BkGdhiIo0k417gfr+V6u4I= +github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk= +github.com/go-redis/redis/v7 v7.3.0 h1:3oHqd0W7f/VLKBxeYTEpqdMUsmMectngjM9OtoRoIgg= +github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/consul/api v1.8.1 h1:BOEQaMWoGMhmQ29fC26bi0qb7/rId9JzZP2V0Xmx7m8= +github.com/hashicorp/consul/api v1.8.1/go.mod h1:sDjTOq0yUyv5G4h+BqSea7Fn6BU+XbolEz1952UB+mk= +github.com/hashicorp/consul/sdk v0.7.0 h1:H6R9d008jDcHPQPAqPNuydAshJ4v5/8URdFnUvK/+sc= +github.com/hashicorp/consul/sdk v0.7.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g= +github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= +github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/consulstructure v0.0.0-20190329231841-56fdc4d2da54 h1:DcITQwl3ymmg7i1XfwpZFs/TPv2PuTwxE8bnuKVtKlk= +github.com/mitchellh/consulstructure v0.0.0-20190329231841-56fdc4d2da54/go.mod h1:dIfpPVUR+ZfkzkDcKnn+oPW1jKeXe4WlNWc7rIXOVxM= +github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pebbe/zmq4 v1.2.7 h1:6EaX83hdFSRUEhgzSW1E/SPoTS3JeYZgYkBvwdcrA9A= +github.com/pebbe/zmq4 v1.2.7/go.mod h1:nqnPueOapVhE2wItZ0uOErngczsJdLOGkebMxaO8r48= +github.com/pelletier/go-toml v1.9.2 h1:7NiByeVF4jKSG1lDF3X8LTIkq2/bu+1uYbIm1eS5tzk= +github.com/pelletier/go-toml v1.9.2/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/soniah/gosnmp v1.21.0 h1:NiPZKeH7B0wJoldNpKa0j7fgOMTNdfh4H2k3xl7J31k= +github.com/soniah/gosnmp v1.21.0/go.mod h1:DuEpAS0az51+DyVBQwITDsoq4++e3LTNckp2GoasF2I= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= +golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From a6e1dd1e1770006b6aed5fee2e766ed4d02624cf Mon Sep 17 00:00:00 2001 From: Mengyi Date: Thu, 28 Oct 2021 13:51:04 +0200 Subject: [PATCH 02/13] feat(snap): add initial snap packaging Signed-off-by: Mengyi --- snap/hooks/pre-refresh | 7 ++ snap/local/.gitkeep | 0 snap/local/hooks/Makefile | 17 +++ snap/local/hooks/cmd/configure/configure.go | 103 +++++++++++++++ snap/local/hooks/cmd/install/install.go | 117 ++++++++++++++++++ snap/local/hooks/const.go | 53 ++++++++ snap/local/hooks/go.mod | 6 + .../runtime-helpers/bin/startup-env-var.sh | 31 +++++ snap/snapcraft.yaml | 108 ++++++++++++++++ 9 files changed, 442 insertions(+) create mode 100755 snap/hooks/pre-refresh create mode 100644 snap/local/.gitkeep create mode 100644 snap/local/hooks/Makefile create mode 100755 snap/local/hooks/cmd/configure/configure.go create mode 100755 snap/local/hooks/cmd/install/install.go create mode 100644 snap/local/hooks/const.go create mode 100644 snap/local/hooks/go.mod create mode 100755 snap/local/runtime-helpers/bin/startup-env-var.sh create mode 100644 snap/snapcraft.yaml diff --git a/snap/hooks/pre-refresh b/snap/hooks/pre-refresh new file mode 100755 index 00000000..27763ca9 --- /dev/null +++ b/snap/hooks/pre-refresh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +# save this revision for when we run again in the post-refresh +snapctl set lastrev="$SNAP_REVISION" + +snapctl set release="jakarta" + diff --git a/snap/local/.gitkeep b/snap/local/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/snap/local/hooks/Makefile b/snap/local/hooks/Makefile new file mode 100644 index 00000000..62377e16 --- /dev/null +++ b/snap/local/hooks/Makefile @@ -0,0 +1,17 @@ +GO=GO111MODULE=on go +HOOKS=cmd/configure/configure cmd/install/install + +tidy: + go mod tidy + +build: tidy $(HOOKS) + +cmd/configure/configure: + $(GO) build -o $@ ./cmd/configure + +cmd/install/install: + $(GO) build -o $@ ./cmd/install + +clean: + rm -f $(HOOKS) + diff --git a/snap/local/hooks/cmd/configure/configure.go b/snap/local/hooks/cmd/configure/configure.go new file mode 100755 index 00000000..ac9c0367 --- /dev/null +++ b/snap/local/hooks/cmd/configure/configure.go @@ -0,0 +1,103 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2021 Canonical Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + * SPDX-License-Identifier: Apache-2.0' + */ + +package main + +import ( + "fmt" + "os" + "strings" + + hooks "github.com/canonical/edgex-snap-hooks/v2" + local "github.com/edgexfoundry/device-snmp-go/hooks" +) + +var cli *hooks.CtlCli = hooks.NewSnapCtl() + +func main() { + var debug = false + var err error + var envJSON string + + status, err := cli.Config("debug") + if err != nil { + fmt.Println(fmt.Sprintf("edgex-device-snmp:configure: can't read value of 'debug': %v", err)) + os.Exit(1) + } + if status == "true" { + debug = true + } + + if err = hooks.Init(debug, "edgex-device-snmp"); err != nil { + fmt.Println(fmt.Sprintf("edgex-device-snmp:configure: initialization failure: %v", err)) + os.Exit(1) + + } + + // read env var override configuration + envJSON, err = cli.Config(hooks.EnvConfig) + if err != nil { + hooks.Error(fmt.Sprintf("Reading config 'env' failed: %v", err)) + os.Exit(1) + } + + if envJSON != "" { + hooks.Debug(fmt.Sprintf("edgex-device-snmp:configure: envJSON: %s", envJSON)) + err = hooks.HandleEdgeXConfig("device-snmp", envJSON, local.ConfToEnv) + if err != nil { + hooks.Error(fmt.Sprintf("HandleEdgeXConfig failed: %v", err)) + os.Exit(1) + } + } + + // If autostart is not explicitly set, default to "no" + // as only example service configuration and profiles + // are provided by default. + autostart, err := cli.Config(hooks.AutostartConfig) + if err != nil { + hooks.Error(fmt.Sprintf("Reading config 'autostart' failed: %v", err)) + os.Exit(1) + } + if autostart == "" { + hooks.Debug("edgex-device-snmp autostart is NOT set, initializing to 'no'") + autostart = "no" + } + autostart = strings.ToLower(autostart) + + hooks.Debug(fmt.Sprintf("edgex-device-snmp autostart is %s", autostart)) + + // service is stopped/disabled by default in the install hook + switch autostart { + case "true": + fallthrough + case "yes": + err = cli.Start("device-snmp", true) + if err != nil { + hooks.Error(fmt.Sprintf("Can't start service - %v", err)) + os.Exit(1) + } + case "false": + // no action necessary + case "no": + // no action necessary + default: + hooks.Error(fmt.Sprintf("Invalid value for 'autostart' : %s", autostart)) + os.Exit(1) + } +} + diff --git a/snap/local/hooks/cmd/install/install.go b/snap/local/hooks/cmd/install/install.go new file mode 100755 index 00000000..931b8ef0 --- /dev/null +++ b/snap/local/hooks/cmd/install/install.go @@ -0,0 +1,117 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2021 Canonical Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + * SPDX-License-Identifier: Apache-2.0' + */ + +package main + +import ( + "fmt" + "os" + "path/filepath" + + hooks "github.com/canonical/edgex-snap-hooks/v2" +) + +var cli *hooks.CtlCli = hooks.NewSnapCtl() + +// installProfiles copies the profile configuration.toml files from $SNAP to $SNAP_DATA. +func installConfig() error { + var err error + + path := "/config/device-snmp/res/configuration.toml" + destFile := hooks.SnapData + path + srcFile := hooks.Snap + path + + if err = os.MkdirAll(filepath.Dir(destFile), 0755); err != nil { + return err + } + + if err = hooks.CopyFile(srcFile, destFile); err != nil { + return err + } + + return nil +} + +func installDevices() error { + var err error + + path := "/config/device-snmp/res/devices/device.snmp.trendnet.TPE082WS.toml" + destFile := hooks.SnapData + path + srcFile := hooks.Snap + path + + if err = os.MkdirAll(filepath.Dir(destFile), 0755); err != nil { + return err + } + + if err = hooks.CopyFile(srcFile, destFile); err != nil { + return err + } + + return nil +} + +func installDevProfiles() error { + var err error + + profs := [...]string{"patlite", "switch.dell.N1108P-ON", "trendnet.TPE082WS"} + + for _, v := range profs { + path := fmt.Sprintf("/config/device-snmp/res/profiles/device.snmp.%s.yaml", v) + destFile := hooks.SnapData + path + srcFile := hooks.Snap + path + + if err := os.MkdirAll(filepath.Dir(destFile), 0755); err != nil { + return err + } + + if err = hooks.CopyFile(srcFile, destFile); err != nil { + return err + } + } + + return nil +} + +func main() { + var err error + + if err = hooks.Init(false, "edgex-device-snmp"); err != nil { + fmt.Println(fmt.Sprintf("edgex-device-snmp::install: initialization failure: %v", err)) + os.Exit(1) + } + + err = installConfig() + if err != nil { + hooks.Error(fmt.Sprintf("edgex-device-snmp:install: %v", err)) + os.Exit(1) + } + + err = installDevices() + if err != nil { + hooks.Error(fmt.Sprintf("edgex-device-snmp:install: %v", err)) + os.Exit(1) + } + + err = installDevProfiles() + if err != nil { + hooks.Error(fmt.Sprintf("edgex-device-snmp:install: %v", err)) + os.Exit(1) + } + +} + diff --git a/snap/local/hooks/const.go b/snap/local/hooks/const.go new file mode 100644 index 00000000..71191eb5 --- /dev/null +++ b/snap/local/hooks/const.go @@ -0,0 +1,53 @@ +// -*- Mode: Go; indent-tabs-mode: t -*- + +/* + * Copyright (C) 2021 Canonical Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * + * SPDX-License-Identifier: Apache-2.0' + */ + +package hooks + +// ConfToEnv defines mappings from snap config keys to EdgeX environment variable +// names that are used to override individual device-snmp's [Driver] configuration +// values via a .env file read by the snap service wrapper. +// +// The syntax to set a configuration key is: +// +// env.
. +// +var ConfToEnv = map[string]string{ + // [snmpBrokerInfo] + "snmpbrokerinfo.schema": "snmpBROKERINFO_SCHEMA", + "snmpbrokerinfo.host": "snmpBROKERINFO_HOST", + "snmpbrokerinfo.port": "snmpBROKERINFO_PORT", + "snmpbrokerinfo.qos": "snmpBROKERINFO_QOS", + "snmpbrokerinfo.keep-alive": "snmpBROKERINFO_KEEPALIVE", + "snmpbrokerinfo.client-id": "snmpBROKERINFO_CLIENTID", + + "snmpbrokerinfo.credentials-retry-time": "snmpBROKERINFO_CREDENTIALSRETRYTIME", + "snmpbrokerinfo.credentials-retry-wait": "snmpBROKERINFO_CREDENTIALSRETRYWAIT", + "snmpbrokerinfo.conn-establishing-retry": "snmpBROKERINFO_CONNESTABLISHINGRETRY", + "snmpbrokerinfo.conn-retry-wait-time": "snmpBROKERINFO_CONNRETRYWAITTIME", + + "snmpbrokerinfo.auth-mode": "snmpBROKERINFO_AUTHMODE", + "snmpbrokerinfo.credentials-path": "snmpBROKERINFO_CREDENTIALSPATH", + + "snmpbrokerinfo.incoming-topic": "snmpBROKERINFO_INCOMINGTOPIC", + "snmpbrokerinfo.response-topic": "snmpBROKERINFO_RESPONSETOPIC", + + // [Device] + "device.update-last-connected": "DEVICE_UPDATELASTCONNECTED", + "device.use-message-bus": "DEVICE_USEMESSAGEBUS", +} + diff --git a/snap/local/hooks/go.mod b/snap/local/hooks/go.mod new file mode 100644 index 00000000..3fc7bf7b --- /dev/null +++ b/snap/local/hooks/go.mod @@ -0,0 +1,6 @@ +module github.com/edgexfoundry/device-snmp-go/hooks + +require github.com/canonical/edgex-snap-hooks/v2 v2.0.3 + +go 1.16 + diff --git a/snap/local/runtime-helpers/bin/startup-env-var.sh b/snap/local/runtime-helpers/bin/startup-env-var.sh new file mode 100755 index 00000000..97c13d5e --- /dev/null +++ b/snap/local/runtime-helpers/bin/startup-env-var.sh @@ -0,0 +1,31 @@ +#!/bin/bash -ex + +EDGEX_STARTUP_DURATION=$(snapctl get startup-duration) + +if [ -n "$EDGEX_STARTUP_DURATION" ]; then + export EDGEX_STARTUP_DURATION +fi + +EDGEX_STARTUP_INTERVAL=$(snapctl get startup-interval) + +if [ -n "$EDGEX_STARTUP_INTERVAL" ]; then + export EDGEX_STARTUP_INTERVAL +fi + +# convert cmdline to string array +ARGV=($@) + +# grab binary path +BINPATH="${ARGV[0]}" + +# binary name == service name/key +SERVICE=$(basename "$BINPATH") +SERVICE_ENV="$SNAP_DATA/config/$SERVICE/res/$SERVICE.env" + +if [ -f "$SERVICE_ENV" ]; then + logger "edgex service override: : sourcing $SERVICE_ENV" + source "$SERVICE_ENV" +fi + +exec "$@" + diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..3fe158a5 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,108 @@ +name: edgex-device-snmp +base: core18 +license: Apache-2.0 +adopt-info: device-snmp +summary: Connect network switches to EdgeX using device-snmp +title: EdgeX snmp Device Service +description: | + This device service provides network switches configuration, sending and + receiving event readings from switches. Currently, this device service + is tailored specifically to the TrendNET TEG-082WS switch. + +# TODO: add armhf when the project supports this +architectures: + - build-on: amd64 + - build-on: arm64 + +grade: stable +confinement: strict + +# edinburgh, geneva,hanoi = 1, ireland,jakarta = 2 +epoch: 2 + +slots: + edgex-secretstore-token: + interface: content + content: edgex-secretstore-token + source: + write: [$SNAP_DATA/device-snmp] + +apps: + device-snmp: + adapter: full + command: bin/device-snmp -confdir $SNAP_DATA/config/device-snmp -profile res --registry $CONSUL_ADDR + command-chain: + - bin/startup-env-var.sh + environment: + CONSUL_ADDR: "consul://localhost:8500" + DEVICE_PROFILESDIR: $SNAP_DATA/config/device-snmp/res/profiles + DEVICE_DEVICESDIR: $SNAP_DATA/config/device-snmp/res/devices + SECRETSTORE_TOKENFILE: $SNAP_DATA/device-snmp/secrets-token.json + WRITABLE_LOGLEVEL: 'INFO' + daemon: simple + passthrough: + install-mode: disable + plugs: [network, network-bind] + +plugs: + device-config: + interface: content + content: device-config + target: $SNAP_DATA/config/device-snmp/res + +parts: + hooks: + source: snap/local/hooks + plugin: make + build-snaps: [go/1.16/stable] + override-build: | + cd $SNAPCRAFT_PART_SRC + make build + install -DT ./cmd/configure/configure $SNAPCRAFT_PART_INSTALL/snap/hooks/configure + install -DT ./cmd/install/install $SNAPCRAFT_PART_INSTALL/snap/hooks/install + + device-snmp: + source: . + plugin: make + build-packages: [git, libzmq3-dev, zip, pkg-config] + stage-packages: [libzmq5] + build-snaps: + - go/1.16/stable + override-build: | + cd $SNAPCRAFT_PART_SRC + + GIT_VERSION=$(git describe --tags --abbrev=0 | sed 's/v//') + if [ -z "$GIT_VERSION" ]; then + GIT_VERSION="0.0.0" + fi + snapcraftctl set-version ${GIT_VERSION} + # this is needed for make build + echo $GIT_VERSION > ./VERSION + + go mod tidy + make build + + install -DT "./cmd/device-snmp" "$SNAPCRAFT_PART_INSTALL/bin/device-snmp" + install -DT "./cmd/res/configuration.toml" "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/configuration.toml" + + for fpath in ./cmd/res/devices/*.toml; do + fname=$(basename "$fpath") + install -DT "./cmd/res/devices/${fname}" \ + "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/devices/${fname}" + done + + for fpath in ./cmd/res/profiles/*.yaml; do + fname=$(basename "$fpath") + install -DT "./cmd/res/profiles/${fname}" \ + "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/profiles/${fname}" + done + + install -DT "./Attribution.txt" \ + "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-snmp/Attribution.txt" + install -DT "./LICENSE" \ + "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-snmp/LICENSE" + + config-common: + plugin: dump + source: snap/local/runtime-helpers + From 53df7902253ff7bacd6b4bf33540b865ce339710 Mon Sep 17 00:00:00 2001 From: Mengyi Date: Thu, 28 Oct 2021 19:26:25 +0200 Subject: [PATCH 03/13] feat(snap): add initial snap packaging (part 2) - update base to core20 - optimize copying config files in snapcraft.yaml - update edgex-snap-hooks to v2.0.7 - remove `GO=GO111MODULE=on go` in snap/local/hooks/Makefile - remove snap/hooks/pre-fresh Signed-off-by: Mengyi --- snap/hooks/pre-refresh | 7 ------- snap/local/hooks/Makefile | 1 - snap/local/hooks/go.mod | 2 +- snap/snapcraft.yaml | 16 ++++------------ 4 files changed, 5 insertions(+), 21 deletions(-) delete mode 100755 snap/hooks/pre-refresh diff --git a/snap/hooks/pre-refresh b/snap/hooks/pre-refresh deleted file mode 100755 index 27763ca9..00000000 --- a/snap/hooks/pre-refresh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -# save this revision for when we run again in the post-refresh -snapctl set lastrev="$SNAP_REVISION" - -snapctl set release="jakarta" - diff --git a/snap/local/hooks/Makefile b/snap/local/hooks/Makefile index 62377e16..f87e5fc3 100644 --- a/snap/local/hooks/Makefile +++ b/snap/local/hooks/Makefile @@ -1,4 +1,3 @@ -GO=GO111MODULE=on go HOOKS=cmd/configure/configure cmd/install/install tidy: diff --git a/snap/local/hooks/go.mod b/snap/local/hooks/go.mod index 3fc7bf7b..45957bf7 100644 --- a/snap/local/hooks/go.mod +++ b/snap/local/hooks/go.mod @@ -1,6 +1,6 @@ module github.com/edgexfoundry/device-snmp-go/hooks -require github.com/canonical/edgex-snap-hooks/v2 v2.0.3 +require github.com/canonical/edgex-snap-hooks/v2 v2.0.7 go 1.16 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 3fe158a5..7216c61e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: edgex-device-snmp -base: core18 +base: core20 license: Apache-2.0 adopt-info: device-snmp summary: Connect network switches to EdgeX using device-snmp @@ -85,17 +85,9 @@ parts: install -DT "./cmd/device-snmp" "$SNAPCRAFT_PART_INSTALL/bin/device-snmp" install -DT "./cmd/res/configuration.toml" "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/configuration.toml" - for fpath in ./cmd/res/devices/*.toml; do - fname=$(basename "$fpath") - install -DT "./cmd/res/devices/${fname}" \ - "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/devices/${fname}" - done - - for fpath in ./cmd/res/profiles/*.yaml; do - fname=$(basename "$fpath") - install -DT "./cmd/res/profiles/${fname}" \ - "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/profiles/${fname}" - done + # copy all config files + mkdir -p $SNAPCRAFT_PART_INSTALL/config/device-snmp + cp -rv cmd/res $SNAPCRAFT_PART_INSTALL/config/device-snmp/res install -DT "./Attribution.txt" \ "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-snmp/Attribution.txt" From 2e721974d9f4888383d6e1743998d8562ef5607e Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 09:48:15 +0200 Subject: [PATCH 04/13] feat(snap): add initial snap packaging (part 3) update `$(GO)` in snap/local/hooks/Makefile Signed-off-by: Mengyi --- snap/local/hooks/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snap/local/hooks/Makefile b/snap/local/hooks/Makefile index f87e5fc3..071f433b 100644 --- a/snap/local/hooks/Makefile +++ b/snap/local/hooks/Makefile @@ -6,10 +6,10 @@ tidy: build: tidy $(HOOKS) cmd/configure/configure: - $(GO) build -o $@ ./cmd/configure + go build -o $@ ./cmd/configure cmd/install/install: - $(GO) build -o $@ ./cmd/install + go build -o $@ ./cmd/install clean: rm -f $(HOOKS) From d382fae48f18ec5aa334d4a5e6c645cf4c510805 Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 13:17:40 +0200 Subject: [PATCH 05/13] feat(snap): add initial snap packaging (part 4) - add go.mod - add go.sum Signed-off-by: Mengyi --- go.mod | 1 + go.sum | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/go.mod b/go.mod index 24ab6056..14a1c75f 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ require ( github.com/edgexfoundry/device-sdk-go/v2 v2.0.0 github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0 github.com/soniah/gosnmp v1.21.0 + golang.org/x/tools v0.1.7 // indirect ) go 1.16 diff --git a/go.sum b/go.sum index 4aac9f9f..548544a5 100644 --- a/go.sum +++ b/go.sum @@ -167,11 +167,15 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -179,9 +183,11 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -198,12 +204,25 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 h1:xFbv3LvlvQAmbNJFCBKRv1Ccvnh9FVsW0FX2kTWWowE= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 4235dfc4d37236fdb11f7ecf1feee155fd8786c8 Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 16:57:19 +0200 Subject: [PATCH 06/13] Revert "feat(snap): add initial snap packaging (part 4)" This reverts commit 01113ef3369497ea442bc7850b5dd2a058e371c6. Signed-off-by: Mengyi --- go.mod | 1 - go.sum | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/go.mod b/go.mod index 14a1c75f..24ab6056 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ require ( github.com/edgexfoundry/device-sdk-go/v2 v2.0.0 github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0 github.com/soniah/gosnmp v1.21.0 - golang.org/x/tools v0.1.7 // indirect ) go 1.16 diff --git a/go.sum b/go.sum index 548544a5..4aac9f9f 100644 --- a/go.sum +++ b/go.sum @@ -167,15 +167,11 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -183,11 +179,9 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -204,25 +198,12 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 h1:xFbv3LvlvQAmbNJFCBKRv1Ccvnh9FVsW0FX2kTWWowE= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From c79dbb56e307aa150aa3776dfe1d5db119f2a781 Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 13:17:40 +0200 Subject: [PATCH 07/13] feat(snap): add initial snap packaging (part 4) - add go.mod - add go.sum Signed-off-by: Mengyi --- go.mod | 1 + go.sum | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/go.mod b/go.mod index 24ab6056..14a1c75f 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ require ( github.com/edgexfoundry/device-sdk-go/v2 v2.0.0 github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0 github.com/soniah/gosnmp v1.21.0 + golang.org/x/tools v0.1.7 // indirect ) go 1.16 diff --git a/go.sum b/go.sum index 4aac9f9f..548544a5 100644 --- a/go.sum +++ b/go.sum @@ -167,11 +167,15 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -179,9 +183,11 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -198,12 +204,25 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 h1:xFbv3LvlvQAmbNJFCBKRv1Ccvnh9FVsW0FX2kTWWowE= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From a19486ac00208908f3ef9270866e90d9e778a1bf Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 17:08:23 +0200 Subject: [PATCH 08/13] Revert "feat(snap): add initial snap packaging (part 4)" This reverts commit dd9a9d848815c925435f7fd8d2711bc0a2ea26eb. Signed-off-by: Mengyi --- go.mod | 1 - go.sum | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/go.mod b/go.mod index 14a1c75f..24ab6056 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ require ( github.com/edgexfoundry/device-sdk-go/v2 v2.0.0 github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0 github.com/soniah/gosnmp v1.21.0 - golang.org/x/tools v0.1.7 // indirect ) go 1.16 diff --git a/go.sum b/go.sum index 548544a5..4aac9f9f 100644 --- a/go.sum +++ b/go.sum @@ -167,15 +167,11 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -183,11 +179,9 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -204,25 +198,12 @@ golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18 h1:xFbv3LvlvQAmbNJFCBKRv1Ccvnh9FVsW0FX2kTWWowE= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From d0f27dc69f2c98021d731602c841e45d38fbe04e Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 17:12:09 +0200 Subject: [PATCH 09/13] fix(snap): go fmt snap/hooks/*.go Signed-off-by: Mengyi --- snap/local/hooks/cmd/configure/configure.go | 1 - snap/local/hooks/cmd/install/install.go | 1 - snap/local/hooks/const.go | 1 - 3 files changed, 3 deletions(-) diff --git a/snap/local/hooks/cmd/configure/configure.go b/snap/local/hooks/cmd/configure/configure.go index ac9c0367..bf7084f8 100755 --- a/snap/local/hooks/cmd/configure/configure.go +++ b/snap/local/hooks/cmd/configure/configure.go @@ -100,4 +100,3 @@ func main() { os.Exit(1) } } - diff --git a/snap/local/hooks/cmd/install/install.go b/snap/local/hooks/cmd/install/install.go index 931b8ef0..6d94d7b1 100755 --- a/snap/local/hooks/cmd/install/install.go +++ b/snap/local/hooks/cmd/install/install.go @@ -114,4 +114,3 @@ func main() { } } - diff --git a/snap/local/hooks/const.go b/snap/local/hooks/const.go index 71191eb5..997befeb 100644 --- a/snap/local/hooks/const.go +++ b/snap/local/hooks/const.go @@ -50,4 +50,3 @@ var ConfToEnv = map[string]string{ "device.update-last-connected": "DEVICE_UPDATELASTCONNECTED", "device.use-message-bus": "DEVICE_USEMESSAGEBUS", } - From 7aee666eab3f285687e6584be5e0596df2918f72 Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 18:28:41 +0200 Subject: [PATCH 10/13] fix(snap): update device-snmp parts in snapcraft.yaml Signed-off-by: Mengyi --- snap/snapcraft.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7216c61e..9949dc4d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -83,11 +83,12 @@ parts: make build install -DT "./cmd/device-snmp" "$SNAPCRAFT_PART_INSTALL/bin/device-snmp" - install -DT "./cmd/res/configuration.toml" "$SNAPCRAFT_PART_INSTALL/config/device-snmp/res/configuration.toml" # copy all config files - mkdir -p $SNAPCRAFT_PART_INSTALL/config/device-snmp - cp -rv cmd/res $SNAPCRAFT_PART_INSTALL/config/device-snmp/res + mkdir -p $SNAPCRAFT_PART_INSTALL/config/device-snmp/res + cp -rv cmd/res/configuration.toml $SNAPCRAFT_PART_INSTALL/config/device-snmp/res/configuration.toml + cp -rv cmd/res/devices $SNAPCRAFT_PART_INSTALL/config/device-snmp/res/devices + cp -rv cmd/res/profiles $SNAPCRAFT_PART_INSTALL/config/device-snmp/res/profiles install -DT "./Attribution.txt" \ "$SNAPCRAFT_PART_INSTALL/usr/share/doc/device-snmp/Attribution.txt" From 28c072d27034e073f8a32804b94c41648bb2c47f Mon Sep 17 00:00:00 2001 From: Mengyi Date: Fri, 29 Oct 2021 18:28:41 +0200 Subject: [PATCH 11/13] fix(snap): add icon in snapcraft.yaml Signed-off-by: Mengyi --- snap/local/assets/edgex-snap-icon.png | Bin 0 -> 11942 bytes snap/snapcraft.yaml | 9 ++++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 snap/local/assets/edgex-snap-icon.png diff --git a/snap/local/assets/edgex-snap-icon.png b/snap/local/assets/edgex-snap-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c67e89dffe59a7d53f5152815b234b53583c29fd GIT binary patch literal 11942 zcmZvCcQ~70_djW{oOJ zP_>1|j>PZn_xgSR`?_3_OWwTayyraUzMuPko-}h)14cSNIuHoNc=yh2OAv?xcuN6- z(g1&)f@&XvK(deT-qyAbqu9nEfd7Gd%ZOG&52k>3aSfjWnB`lgwRr}-cA{G!&&B)z zUjFxYlH`K@X&fq4`TXZ^Zm%cp-PVVb=SP;wL>-m{Sf5X-E(iaWQ-VtD>t$rYK2>+y zm~Cp(DFhe&`IekW*eI^^JkE@jX=)Z4>%`3!eojpO@&xpvKWb=7o|$U@wGQY!?lCOq z6W6U2D+wxy^UE_$kOoF&_*2ksUOP0waNnS;f2F-?kn)ChW(Nq=-D8?s-Qk^ar$B@y z{ThlEIi`KSe9W?!t|_Q1Lc_JhS+xwgzRcfuU3_1YUxI}B9LW22@Qqk2gaWeK;n_!=%Ix7|7+MdJ31)S~e24DK4A(EM!TAvPy zg}!u$MlFSxh01Eb{)@yOgh^LAgqk|@-&CA2ms1fGsR^61#*Fjvb`RAT5||4T;#}Z^ zd-@+`b(WqkRjB!ENjKBG_@uES=k8mL9F(i@-n~~3 zt|t-WzzhgGAO4a_I#A=`XexolggaNS;xLvv16ah2d}zwzbRxSvzq>21vn>y`#+R$9 zN&e+3Ixls4=;K0>TyHmIXD?eKPejLQLPhdlr4-AzlQ!Sy0As91qEbx3M zi?Sg@lcp=ad8dGyTR8t#vgXo>CMeD+*)hH#SJ#arRf~RJ!H-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Subject: [PATCH 12/13] fix(snap): update snap packaging - add snap/README.md - update snap/local/hooks/const.go - remove snap/local/.gitkeep Signed-off-by: Mengyi --- snap/README.md | 167 ++++++++++++++++++++++++++++++++++++++ snap/local/.gitkeep | 0 snap/local/hooks/const.go | 19 ----- 3 files changed, 167 insertions(+), 19 deletions(-) create mode 100644 snap/README.md delete mode 100644 snap/local/.gitkeep diff --git a/snap/README.md b/snap/README.md new file mode 100644 index 00000000..dcdaa115 --- /dev/null +++ b/snap/README.md @@ -0,0 +1,167 @@ +# EdgeX SNMP Device Service Snap + +[![snap store badge](https://raw.githubusercontent.com/snapcore/snap-store-badges/master/EN/%5BEN%5D-snap-store-black-uneditable.png)](https://snapcraft.io/edgex-device-snmp) + +This folder contains snap packaging for the EdgeX SNMP Protocol Device Service Snap + +The snap currently supports both `amd64` and `arm64` platforms + +## Installation + +### Installing snapd + +The snap can be installed on any system that supports snaps. You can see how to install snaps on your system [here](https://snapcraft.io/docs/installing-snapd/6735). + +However for full security confinement, the snap should be installed on an Ubuntu 18.04 LTS or later (Desktop or Server), or a system running Ubuntu Core 18 or later. + +### Installing EdgeX Device SNMP as a snap + +The snap is published in the snap store at https://snapcraft.io/edgex-device-snmp. You can see the current revisions available for your machine's architecture by running the command: + +``` +$ snap info edgex-device-snmp +``` + +The latest stable version of the snap can be installed using: + +``` +$ sudo snap install edgex-device-snmp +``` + +A specific release of the snap can be installed from a dedicated channel. For example, to install the 2.1 (Jakarta) release: + +``` +$ sudo snap install edgex-device-snmp --channel=2.1 +``` + +The latest development version of the snap can be installed using: + +``` +$ sudo snap install edgex-device-snmp --edge +``` + +**Note** - the snap has only been tested on Ubuntu Core, Desktop, and Server. + +## Snap configuration + +Device services implement a service dependency check on startup which ensures that all of the runtime dependencies of a particular service are met before the service transitions to active state. + +Snapd doesn't support orchestration between services in different snaps. It is therefore possible on a reboot for a device service to come up faster than all of the required services running in the main edgexfoundry snap. If this happens, it's possible that the device service repeatedly fails startup, and if it exceeds the systemd default limits, then it might be left in a failed state. This situation might be more likely on constrained hardware (e.g. RPi). + +This snap therefore implements a basic retry loop with a maximum duration and sleep interval. If the dependent services are not available, the service sleeps for the defined interval (default: 1s) and then tries again up to a maximum duration (default: 60s). These values can be overridden with the following commands: + +To change the maximum duration, use the following command: + +``` +$ sudo snap set edgex-device-snmp startup-duration=60 +``` + +To change the interval between retries, use the following command: + +``` +$ sudo snap set edgex-device-snmp startup-interval=1 +``` + +The service can then be started as follows. The "--enable" option ensures that as well as starting the service now, it will be automatically started on boot: + +``` +$ sudo snap start --enable edgex-device-snmp.device-snmp +``` + +### Using a content interface to set device configuration + +The `device-config` content interface allows another snap to seed this device snap with both a configuration file and one or more device profiles. + +To use, create a new snap with a directory containing the configuration and device profile files. Your snapcraft.yaml file then needs to define a slot with read access to the directory you are sharing. + +``` +slots: + device-config: + interface: content + content: device-config + write: + - $SNAP/config +``` + +where `$SNAP/config` is configuration directory your snap is providing to the device snap. + +Then connect the plug in the device snap to the slot in your snap, which will replace the configuration in the device snap. Do this with: + +``` +$ sudo snap connect edgex-device-snmp:device-config your-snap:device-config +``` + +This needs to be done before the device service is started for the first time. Once you have set the configuration the device service can be started and it will then be configurated using the settings you provided: + +``` +$ sudo snap start edgex-device-snmp.device-snmp +``` + +**Note** - content interfaces from snaps installed from the Snap Store that have the same publisher connect automatically. For more information on snap content interfaces please refer to the snapcraft.io [Content Interface](https://snapcraft.io/docs/content-interface) documentation. + +### Autostart + +By default, the edgex-device-snmp disables its service on install, as the expectation is that the default profile configuration files will be customized, and thus this behavior allows the profile `configuration.toml` files in $SNAP_DATA to be modified before the service is first started. + +This behavior can be overridden by setting the `autostart` configuration setting to "true". This is useful when configuration and/or device profiles are being provided via configuration or gadget snap content interface. + +**Note** - this option is typically set from a gadget snap. + +### Rich Configuration + +While it's possible on Ubuntu Core to provide additional profiles via gadget snap content interface, quite often only minor changes to existing profiles are required. + +These changes can be accomplished via support for EdgeX environment variable configuration overrides via the snap's configure hook. If the service has already been started, setting one of these overrides currently requires the service to be restarted via the command-line or snapd's REST API. If the overrides are provided via the snap configuration defaults capability of a gadget snap, the overrides will be picked up when the services are first started. + +The following syntax is used to specify service-specific configuration overrides: + +``` +env.. +``` + +For instance, to setup an override of the service's Port use: + +``` +$ sudo snap set edgex-device-snmp env.service.port=2112 +``` + +And restart the service: + +``` +$ sudo snap restart edgex-device-snmp.device-snmp +``` + +**Note** - at this time changes to configuration values in the [Writable] section are not supported. For details on the mapping of configuration options to Config options, please refer to "Service Environment Configuration Overrides". + +## Service Environment Configuration Overrides + +**Note** - all of the configuration options below must be specified with the prefix: `env.` + +``` +[Service] +service.boot-timeout // Service.BootTimeout +service.health-check-interval // Service.HealthCheckInterval +service.host // Service.Host +service.server-bind-addr // Service.ServerBindAddr +service.port // Service.Port +service.protocol // Service.Protocol +service.max-result-count // Service.MaxResultCount +service.max-request-size // Service.MaxRequestSize +service.startup-msg // Service.StartupMsg +service.request-timeout // Service.RequestTimeout + +[SecretStore] +secret-store.secrets-file // SecretStore.SecretsFile +secret-store.disable-scrub-secrets-file // SecretStore.DisableScrubSecretsFile + +[Clients.core-data] +clients.core-data.port // Clients.core-data.Port + +[Clients.core-metadata] +clients.core-metadata.port // Clients.core-metadata.Port + +[Device] +device.update-last-connected // Device.UpdateLastConnected +device.use-message-bus // Device.UseMessageBus +``` + diff --git a/snap/local/.gitkeep b/snap/local/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/snap/local/hooks/const.go b/snap/local/hooks/const.go index 997befeb..e4d13b95 100644 --- a/snap/local/hooks/const.go +++ b/snap/local/hooks/const.go @@ -27,25 +27,6 @@ package hooks // env.
. // var ConfToEnv = map[string]string{ - // [snmpBrokerInfo] - "snmpbrokerinfo.schema": "snmpBROKERINFO_SCHEMA", - "snmpbrokerinfo.host": "snmpBROKERINFO_HOST", - "snmpbrokerinfo.port": "snmpBROKERINFO_PORT", - "snmpbrokerinfo.qos": "snmpBROKERINFO_QOS", - "snmpbrokerinfo.keep-alive": "snmpBROKERINFO_KEEPALIVE", - "snmpbrokerinfo.client-id": "snmpBROKERINFO_CLIENTID", - - "snmpbrokerinfo.credentials-retry-time": "snmpBROKERINFO_CREDENTIALSRETRYTIME", - "snmpbrokerinfo.credentials-retry-wait": "snmpBROKERINFO_CREDENTIALSRETRYWAIT", - "snmpbrokerinfo.conn-establishing-retry": "snmpBROKERINFO_CONNESTABLISHINGRETRY", - "snmpbrokerinfo.conn-retry-wait-time": "snmpBROKERINFO_CONNRETRYWAITTIME", - - "snmpbrokerinfo.auth-mode": "snmpBROKERINFO_AUTHMODE", - "snmpbrokerinfo.credentials-path": "snmpBROKERINFO_CREDENTIALSPATH", - - "snmpbrokerinfo.incoming-topic": "snmpBROKERINFO_INCOMINGTOPIC", - "snmpbrokerinfo.response-topic": "snmpBROKERINFO_RESPONSETOPIC", - // [Device] "device.update-last-connected": "DEVICE_UPDATELASTCONNECTED", "device.use-message-bus": "DEVICE_USEMESSAGEBUS", From e0d79c548ac688cf743d558927d7f399e9d4b24f Mon Sep 17 00:00:00 2001 From: Mengyi Date: Tue, 9 Nov 2021 08:14:27 +0100 Subject: [PATCH 13/13] fix(snap): update snap/README.md - update `Using a content interface to set device configuration` - remove `Service.BootTimeout` and `Service.Protocol` in `Service Environment Configuration Overrides` - update words based on https://github.com/edgexfoundry/ device-mqtt-go/pull/311/files Signed-off-by: Mengyi --- snap/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/snap/README.md b/snap/README.md index dcdaa115..d2d388bc 100644 --- a/snap/README.md +++ b/snap/README.md @@ -70,16 +70,19 @@ $ sudo snap start --enable edgex-device-snmp.device-snmp ### Using a content interface to set device configuration -The `device-config` content interface allows another snap to seed this device snap with both a configuration file and one or more device profiles. +The `device-config` content interface allows another snap to seed this device +snap with configuration files under the `$SNAP_DATA/config/device-snmp/res` directory. -To use, create a new snap with a directory containing the configuration and device profile files. Your snapcraft.yaml file then needs to define a slot with read access to the directory you are sharing. +Note that the `device-config` content interface does NOT support seeding of the Secret Store Token because that file is expected at a different path. + +To use, create a new snap with a directory containing the configuration files. Your snapcraft.yaml file then needs to define a slot with read access to the directory you are sharing. ``` slots: device-config: interface: content content: device-config - write: + read: - $SNAP/config ``` @@ -91,7 +94,7 @@ Then connect the plug in the device snap to the slot in your snap, which will re $ sudo snap connect edgex-device-snmp:device-config your-snap:device-config ``` -This needs to be done before the device service is started for the first time. Once you have set the configuration the device service can be started and it will then be configurated using the settings you provided: +This needs to be done before the device service is started for the first time. Once you have set the configuration the device service can be started and it will then be configured using the settings you provided: ``` $ sudo snap start edgex-device-snmp.device-snmp @@ -139,12 +142,10 @@ $ sudo snap restart edgex-device-snmp.device-snmp ``` [Service] -service.boot-timeout // Service.BootTimeout service.health-check-interval // Service.HealthCheckInterval service.host // Service.Host service.server-bind-addr // Service.ServerBindAddr service.port // Service.Port -service.protocol // Service.Protocol service.max-result-count // Service.MaxResultCount service.max-request-size // Service.MaxRequestSize service.startup-msg // Service.StartupMsg