Commit Graph

29 Commits

Author SHA1 Message Date
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
gotjosh 2fb45eeec8
Grafana-CLI: Wrapper for `grafana-cli` within RPM/DEB packages and config/homepath are now global flags (#17695)
* Feature: Introduce a grafana-cli wrapper

When our users install the *nix packed version of grafana, tendency is to use the services and scripts installed as part of the package for grafana-server. These leverage the default configuration options by specifying the several default paths.

This introduces a similar approach for the grafana-cli binary. We exposed it through a wrapper to ensure a proper configuration is in place. To enable that, we add the .real suffix to the original binary (grafana-cli.real) and then use a bash script named grafana-cli as the wrapper.

* Make the config and homepath flags global

* Introduce `configOverrides` as a global flag

This flag allows us to pass configuration overrides as a string.

The string follows the convention of configuration arguments separated by a space e.g. "cfg:default.paths.data=/dev/nullX cfg:default.paths.logs=/dev/nullX"

Also, it is backwards compatible with similar the previous configuration method through tailing arguments. Tailing arguments take presedence over the configuration options string.

* Only log configuration information in debug mode

* Move the grafana-cli binary to $GRAFANA_HOME/bin

As part of the package install process, we copy all the release files and
directories into the grafana home directory. This includes the /bin folder
from where we copied the binaries into their respective destinations.
After that, the /bin folder gets deleted as we don't want to keep
duplicates of the binaries around.

As part of this commit, we moved the re-creation of /bin within
grafana-home and the copy of the original binary (again) after the
folder gets deleted.
2019-06-24 20:20:21 +01:00
gotjosh 7d68d6ede2
grafana-cli: Fix receiving flags via command line (#17617)
`grafana-cli` uses the third-party library to define the flags and not
the standard library. Using `flag.Parse` conflicts with the defined
flags from our third-party library.

In the case where `flag.Parse` is used, the CLI assumes that definitions
provided are not needed and will not define them; producing errors of
the kind `flag provided but not defined --example-flag`.

Using the context to read any arguments (including flags) is the
recommended approach by the third-party library.
2019-06-18 10:25:37 +01:00
gotjosh 6fbca90269
cli: grafana-cli should receive flags from the command line (#17606)
grafana-cli should allow configuration overrides to be received from the command line. e.g.

```
grafana-cli admin reset-password cfg:default.paths.logs=custom/log/directory/
```

Seems like we missed the inclusion of `flag.Parse` as we run the command,  to be able to consume them.

Additionally, it'll be useful for the user to know whenever these are being overriden or not - hence the addition of logging the configuration to be used as we run the command.
2019-06-17 11:27:26 +01:00
Andrej Ocenas 151b24b95f CLI: Add command to migrate all datasources to use encrypted password fields (#17118)
closes: #17107
2019-05-27 10:47:21 +02:00
Oleg Gaidarenko 04b3afcd15
Chore: Implement revive (#16200)
Since we do not like some of the default golint rules,
this commit proposes to use https://github.com/mgechev/revive.

And potential revive speed-up should't hurt :).

Right now, presented config (./conf/revive.toml) is permissive,
we might improve it over time however. Fixes for found revive
issues in the code are very limited so it wouldn't be large to review.

Also in this commit:

* Add annotations for makefile commands and declare phony targets

* Rename "gometalinter" script and CI command to "lint"
  since we are doing there a bit more then using gometalinter package

* Add Makefile rules to .editorconfig

* Documentation which mentioned "golint" replaced with revive

Fixes #16109
Ref #16160
2019-03-27 17:53:49 +01:00
Marcus Efraimsson 90595ffdce
cli: fix init of bus 2018-09-25 21:31:24 +02:00
Torkel Ödegaard 6c0752473a
Sqlstore refactor (#11908)
* refactor: tracing service refactoring

* refactor: sqlstore to instance service

* refactor: sqlstore & registory priority

* refactor: sqlstore refactor wip

* sqlstore: progress on getting tests to work again

* sqlstore: progress on refactoring and getting tests working

* sqlstore: connection string fix

* fix: not sure why this test is not working and required changing expires

* fix: updated grafana-cli
2018-05-18 11:10:10 +02:00
Torkel Ödegaard fa7d7ed5df
Initial Baby Step to refactoring settings from global vars to instance (#11777)
* wip: start on refactoring settings

* settings: progress on settings refactor

* refactor: progress on settings refactoring

* fix: fixed failing test

* settings: moved smtp settings from global to instance
2018-04-30 16:21:04 +02:00
Daniel Lee 6ec1d16327 fix: cli admin reset-password fixes cmd args
Fixes the homepath and config command line args. This allows the
command to be used even when the homepath is different from the
default.

Fixes #7730
2017-04-20 13:30:17 +02:00
bergquist 96e8ecfa7b feat(cli): adds command to reset admin password
closes #5479
2016-12-09 15:25:02 +01:00
bergquist cd85e1f651 Merge branch 'master' into cli_db_commands 2016-12-09 12:36:05 +01:00
bergquist 645293e590 fix(cli): improve error message for upgrade-all
closes #5885
2016-08-30 13:47:42 +02:00
bergquist c087445d51 feat(cli): add db command to cli. 2016-08-24 15:46:26 +02:00
Mark Henderson 39be7cf7d7 Added grafana-cli command. Added public documentation for specifying plugin version when installing. (#5665) 2016-07-27 09:41:33 +02:00
bergquist 2123fbdf9b feat(cli): make remove command an alias for uninstall 2016-06-23 08:21:55 +02:00
bergquist 15aeb4aec2 tech(cli): rename log to logger to separate from server logger 2016-06-03 12:22:30 +02:00
bergquist 07b13e24fa style(cli): add some color to error messages 2016-04-23 14:39:42 +02:00
Torkel Ödegaard f93b039e42 change(grafana-cli): changed upgrade to update in command line, upgrade and upgrade-all will still work as aliases 2016-04-11 18:05:28 -04:00
bergquist eeb7524c0f feat(cli): improve helptext for cli 2016-04-11 14:50:34 +02:00
bergquist 2fd25f0093 feat(cli): add uninstall alias for remove 2016-04-11 14:49:12 +02:00
bergquist 7f8643efde feat(cli): make all plugin commands subcommands 2016-03-21 10:01:07 +01:00
bergquist f5bb2b11e5 feat(cli): improve error handling for missing plugin dir 2016-03-11 14:11:25 +01:00
bergquist 1a6af064b0 fix(cli): improve logging when folders does not exists 2016-03-07 16:41:22 +01:00
bergquist 4131d8b57a feat(cli): add command for upgrading one plugin 2016-02-16 08:49:27 +01:00
bergquist 746257710b fix(cli): align code with core grafana 2016-02-15 16:11:37 +01:00
bergquist 5adac86b43 fix(cli): remove dev text values 2016-02-15 14:19:59 +01:00
bergquist d59beec354 feat(cli): move cli into main repo 2016-02-15 14:09:34 +01:00