Commit Graph

47 Commits

Author SHA1 Message Date
Jo
ca72cd570e
Remove ioutil.ReadDir from usage (#53550)
* add depguard rule for ioutil

* replace ioutil.ReadDir with os.ReadDir

* use legacy option in depguard supported in golangci-lint v1.40

* replace ioutil.ReadDir with os.ReadDir

* return error for file info
2022-08-11 07:21:12 -04:00
Jo
062d255124
Handle ioutil deprecations (#53526)
* replace ioutil.ReadFile -> os.ReadFile

* replace ioutil.ReadAll -> io.ReadAll

* replace ioutil.TempFile -> os.CreateTemp

* replace ioutil.NopCloser -> io.NopCloser

* replace ioutil.WriteFile -> os.WriteFile

* replace ioutil.TempDir -> os.MkdirTemp

* replace ioutil.Discard -> io.Discard
2022-08-10 15:37:51 +02:00
Kat Yang
3c3039f5b3
Chore: Remove Wrap (#50048)
* Chore: Remove Wrap and Wrapf

* Fix: Add error check
2022-06-03 09:24:24 +02:00
Will Browne
8e6205c107
Plugins: Move plugin installing + uninstalling logic from CLI to plugins package (#33274)
* move guts from cli to server

* renaming + refactoring

* add pluginsDir arg

* arg fixes

* add support for repo URL override

* add funcs to interface

* use pluginID consistently

* swap args

* pass mandatory grafanaVersion field

* introduce logger interface

* create central logger for CLI

* add infra log wrapper

* re-add log initer step

* remove unused logger

* add checks for uninstalling

* improve debug blue

* make sure to close file

* fix linter issues

* remove space

* improve newline usage

* refactor packaging

* improve logger API

* fix interface func names

* close file and reformat zipslip catch

* handle G305 linter warning

* add helpful debug log
2021-04-26 16:13:40 +02:00
ying-jeanne
3b087db6ac
Fix: cli error message when installing plugin doesn't include helpful… (#32467)
* Fix: cli error message when installing plugin doesn't include helpful info

* Update pkg/cmd/grafana-cli/services/api_client.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-30 10:58:08 +02:00
ying-jeanne
db67e70ba4
use sha256 checksum instead of md5 (#30018)
* use sha256 checksum instead of md5

* Chore: Rewrite ldap login test to standard library (#29998)

* Chore: Rewrite ldap login test to standard library

* Preserve original ldap enabled setting after test

* Chore: Rewrite models alert test to standard library (#30021)

* Chore: Rewrite models dashboard acl test to standard library (#30022)

* Chore: Rewrite models dashboards test to standard library (#30023)

* Chore: Rewrite login auth test to standard library (#29985)

* Chore: Rewrite login auth test to standard library

* Use assert.Empty when empty string expected

* Chore: Rewrite brute force login protection test to standard library (#29986)

* Update pkg/cmd/grafana-cli/services/api_client.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/cmd/grafana-cli/services/api_client.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* use sha256 checksum instead of md5

* Update pkg/cmd/grafana-cli/services/api_client.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/cmd/grafana-cli/services/api_client.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* grafana-cli: Remove MD5

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Hessman <emil@hessman.se>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-01-04 13:27:47 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter (#29751)
* Disable default golangci-lint filter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix linter warnings

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Arve Knudsen
f326b79cc1
Security: Add gosec G304 auditing annotations (#29578)
* Security: Add gosec G304 auditing annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* add G304 auditing comment

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* space

Signed-off-by: bergquist <carl.bergquist@gmail.com>

* Add gosec annotations

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: bergquist <carl.bergquist@gmail.com>
2020-12-03 22:13:06 +01:00
Arve Knudsen
9593d57914
Chore: Enable errorlint linter (#29227)
* Enable errorlint linter
* Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 14:47:17 +01:00
Arve Knudsen
52c154a221
Backend: Rename variables for style conformance (#29097)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 17:09:14 +01:00
Arve Knudsen
9f159c5e3d
grafana-cli: Fix file path processing, returning of errors (#26954)
* grafana-cli: Fix file path processing, returning of errors
2020-08-13 09:38:05 +02:00
Arve Knudsen
16c185c3b9
Chore: Drop xerrors dependency (#26718)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-31 09:45:20 +02:00
Arve Knudsen
5070f7a75b
Chore: Start harmonizing linting with plugin SDK (#25854)
* Chore: Harmonize linting with plugin SDK

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix linting issues

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 14:08:32 +02:00
Carl Bergquist
766d8a5888
avoid aliased import in cli (#22566) 2020-03-04 13:18:13 +01:00
Olivier Lemasle
b4712ec4b9 CLI: Reduce memory usage for plugin installation (#19639)
* grafana-cli: use tmp file when downloading plugin install file
2019-11-06 13:42:58 +01:00
Arve Knudsen
573e78feeb
pkg/cmd: Check errors (#19700)
* pkg/cmd: Check errors
* pkg/cmd: Make sure server waits on services, even in case of error
* pkg/cmd: Inform of error to show help
* pkg/cmd: Only warn on failure to send systemd notification
* pkg/cmd: Don't log errors stemming from context cancelation
* pkg/cmd: Don't fail if unable to write to systemd
2019-10-15 16:44:15 +02:00
Andrej Ocenas
8c49d27705
CLI: Allow installing custom binary plugins (#17551)
Make sure all data is sent to API to be able to select correct archive version.
2019-07-29 10:44:58 +02:00
Mario Trangoni
87760d4fde Codestyle: Fix govet issues (#17178)
ref #10381

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2019-06-04 22:00:05 +02:00
Oleg Gaidarenko
be66ed9dab
Chore: explore possibilities of using makefile (#17039)
* Chore: explore possibilities of using makefile

This is an exploratory commit - I wanted to see how
revive/gosec linters could be integrated with makefile and our build scripts.

Looks better then I expected :)

* Chore: make revive happy

Revive execution was not supplied with path, if you restore there is couple
errors that were popping up - so I fixed them

* Chore: make revive happy
2019-05-16 00:29:26 +03:00
Carl Bergquist
a86b8c8a04
http: remove dualstack since its deprecated (#16940)
Deprecated: Fast Fallback is enabled by default. To
disable, set FallbackDelay to a negative value.

https://golang.org/src/net/dial.go
2019-05-08 10:37:48 +02:00
Andrej Ocenas
e4f649e2c8
Chore: Small improvements to grafana-cli (#16670)
* Small improvements

* Better error handling
2019-04-23 12:34:34 +02:00
Dan Cech
124b21a6aa
use pluginName consistently when upgrading plugins 2018-09-13 17:19:51 -04:00
bergquist
12c9860882 string formating fixes 2018-08-28 22:33:38 +02:00
bergquist
03a9650c57 cli: adds os and arch headers
this makes it possible for the plugin repo
to provide the correct package if arch and os matters
2018-04-20 09:52:25 +02:00
Mario Trangoni
ce941a004d fix unconvert issues 2018-04-16 20:04:58 +02:00
Matt Bostock
16c5d0e4b7 Always verify TLS unless explicitly told otherwise
TLS was not being verified in a number of places:

- connections to grafana.com

- connections to OAuth providers when TLS client authentication was
  enabled

- connections to self-hosted Grafana installations when using the CLI
  tool

TLS should always be verified unless the user explicitly enables an
option to skip verification.

Removes some instances where `InsecureSkipVerify` is explicitly set to
`false`, the default, to help avoid confusion and make it more difficult
to regress on this fix by accident.

Adds a `--insecure` flag to `grafana-cli` to skip TLS verification.

Adds a `tls_skip_verify_insecure` setting for OAuth.

Adds a `app_tls_skip_verify_insecure` setting under a new `[plugins]`
section.

I'm not super happy with the way the global setting is used by
`pkg/api/app_routes.go` but that seems to be the existing pattern used.
2017-10-06 17:09:27 +01:00
Ivan Babrou
9a4ae30227
Enable dualstack in every net.Dialer, fixes #9364
Default transport enables it:

* https://github.com/golang/go/blob/d2826d3e06/src/net/http/transport.go#L42-L46

```
    DialContext: (&net.Dialer{
	Timeout:   30 * time.Second,
	KeepAlive: 30 * time.Second,
	DualStack: true,
    }).DialContext,
```

See also: https://github.com/golang/go/issues/15324
2017-09-27 22:29:48 -07:00
bergquist
578507ae77 tech(cli): add default settings for transport 2016-11-01 08:58:44 +01:00
David Moravek
c6257b30c1 Take grafana-cli proxy settings from env 2016-10-31 23:14:48 +01:00
bergquist
6e65c93203 fix(cli): improve error handling 2016-10-21 16:03:02 +02:00
bergquist
2e4ca64783 fix(cli): improve error handling
closes #6256
2016-10-12 22:31:28 +02:00
bergquist
d2fb660557 fix(cli): remove unused logging 2016-09-20 10:10:27 +02:00
bergquist
3c92f78ee7 feat(cli): add grafana version header to all request against grafana.net 2016-09-15 16:01:06 +02:00
bergquist
af216ecf83 tech(cli): remove loop and head straight for plugindir 2016-06-26 03:47:15 +02:00
bergquist
af1c8dc5d9 feat(cli): adds support for dist/plugin.json location for plugins
ref #5410
2016-06-23 08:35:40 +02:00
bergquist
15aeb4aec2 tech(cli): rename log to logger to separate from server logger 2016-06-03 12:22:30 +02:00
Dan Cech
9f9f4e7fef use new plugin-specific repo route when installing or updating a single plugin (#4992) 2016-05-12 10:43:31 +02:00
Anthony Woods
036f407d6a gofmt 2016-03-29 16:04:24 +08:00
Anthony Woods
2c60dbd4fb handle errors when requesting plugin list. fixes #4494 2016-03-29 15:35:08 +08:00
Torkel Ödegaard
1e44ee9e9b feat(grafana-cli): minor changes 2016-03-28 21:42:26 +02:00
bergquist
5094c1db2a feat(cli): improves error message for 401 requests 2016-03-11 14:34:48 +01:00
bergquist
fee0745e98 feat(cli): support for asking grafana net about plugins 2016-03-10 16:25:34 +01:00
bergquist
6670e6cd29 feat(cli): allow redirect for plugin-repo.json 2016-03-09 16:10:46 +01:00
bergquist
f6c5242a93 feat(cli): make repo url a parameter
this is a quick hack to support repo url as parameter. Will refactor
later
2016-03-07 13:29:45 +01:00
bergquist
4131d8b57a feat(cli): add command for upgrading one plugin 2016-02-16 08:49:27 +01:00
bergquist
ea9ac0d2d2 chore(cli): improve unittests 2016-02-15 18:32:36 +01:00
bergquist
d59beec354 feat(cli): move cli into main repo 2016-02-15 14:09:34 +01:00