diff --git a/.travis.yml b/.travis.yml index 34e08d7bd..7fa4eca8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,16 +13,16 @@ before_install: - go get golang.org/x/tools/cmd/vet - go get golang.org/x/tools/cmd/goimports - go get github.com/smartystreets/goconvey/convey -- if [ ! -d $PULSE_SOURCE ]; then mkdir -p $HOME/gopath/src/github.com/intelsdi-x; ln -s $TRAVIS_BUILD_DIR $PULSE_SOURCE; fi # CI for forks not from intelsdi-x +- if [ ! -d $SNAP_SOURCE ]; then mkdir -p $HOME/gopath/src/github.com/intelsdi-x; ln -s $TRAVIS_BUILD_DIR $SNAP_SOURCE; fi # CI for forks not from intelsdi-x - go get golang.org/x/tools/cmd/cover env: global: - - PULSE_SOURCE=/home/travis/gopath/src/github.com/intelsdi-x/pulse - - PULSE_PATH=/home/travis/gopath/src/github.com/intelsdi-x/pulse/build + - SNAP_SOURCE=/home/travis/gopath/src/github.com/intelsdi-x/snap + - SNAP_PATH=/home/travis/gopath/src/github.com/intelsdi-x/snap/build install: - export TMPDIR=$HOME/tmp - mkdir -p $TMPDIR -- cd $PULSE_SOURCE # change dir into source +- cd $SNAP_SOURCE # change dir into source - make script: - make check 2>&1 # Run test suite diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca4fc970b..7ac2ad8fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,8 @@ ##Build and Test ###Build -In the /pulse directory there's a `Makefile` that builds all dependencies and Pulse. -To get dependencies and build Pulse just run: +In the /snap directory there's a `Makefile` that builds all dependencies and snap. +To get dependencies and build snap just run: ``` make ``` @@ -20,23 +20,23 @@ deps: #gets all dependencies using godeps bash -c "./scripts/deps.sh" test: - #exports Pulse build path to env var PULSE_PATH and runs test files - export PULSE_PATH=`pwd`/build; bash -c "./scripts/test.sh" + #exports snap build path to env var SNAP_PATH and runs test files + export SNAP_PATH=`pwd`/build; bash -c "./scripts/test.sh" check: #runs make test $(MAKE) test all: - #builds Pulse daemon, CLI, and plugin binaries + #builds snap daemon, CLI, and plugin binaries bash -c "./scripts/build.sh $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) true" -pulse: - #builds Pulse daemon and CLI binaries, but not plugin binaries +snap: + #builds snap daemon and CLI binaries, but not plugin binaries bash -c "./scripts/build.sh $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))" install: - #copies pulsed and pulsectl binaries into /usr/local/bin - cp build/bin/pulsed /usr/local/bin/ - cp build/bin/pulsectl /usr/local/bin/ + #copies snapd and snapctl binaries into /usr/local/bin + cp build/bin/snapd /usr/local/bin/ + cp build/bin/snapctl /usr/local/bin/ release: - #creates a Pulse release + #creates a snap release bash -c "./scripts/release.sh $(TAG) $(COMMIT)" ``` @@ -81,13 +81,13 @@ There's a `Dockerfile` located at `./scripts/Dockerfile`: ``` FROM golang:latest ENV GOPATH=$GOPATH:/app -ENV PULSE_PATH=/go/src/github.com/intelsdi-x/pulse/build +ENV SNAP_PATH=/go/src/github.com/intelsdi-x/snap/build RUN apt-get update && \ apt-get -y install facter WORKDIR /go/src/github.com/intelsdi-x/ RUN git clone https://@github.com/intelsdi-x/gomit.git -WORKDIR /go/src/github.com/intelsdi-x/pulse -ADD . /go/src/github.com/intelsdi-x/pulse +WORKDIR /go/src/github.com/intelsdi-x/snap +ADD . /go/src/github.com/intelsdi-x/snap RUN go get github.com/tools/godep && \ go get golang.org/x/tools/cmd/goimports && \ go get golang.org/x/tools/cmd/vet && \ @@ -96,7 +96,7 @@ RUN go get github.com/tools/godep && \ RUN scripts/deps.sh RUN make ``` -This is run in the pulse directory using `./scripts/run_tests_with_docker.sh` +This is run in the snap directory using `./scripts/run_tests_with_docker.sh` First you need a [github personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) Then export the token using `export GIT_TOKEN=`. @@ -117,7 +117,7 @@ if [ -z "${GIT_TOKEN}" ]; then fi sed s/\/${GIT_TOKEN}/ scripts/Dockerfile > scripts/Dockerfile.tmp -docker build -t intelsdi-x/pulse-test -f scripts/Dockerfile.tmp . +docker build -t intelsdi-x/snap-test -f scripts/Dockerfile.tmp . rm scripts/Dockerfile.tmp -docker run -it intelsdi-x/pulse-test scripts/test.sh -``` \ No newline at end of file +docker run -it intelsdi-x/snap-test scripts/test.sh +``` diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 7af1c7482..092ab68ec 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,5 +1,5 @@ { - "ImportPath": "github.com/intelsdi-x/pulse", + "ImportPath": "github.com/intelsdi-x/snap", "GoVersion": "go1.4.2", "Deps": [ { diff --git a/Makefile b/Makefile index 194bcee7e..cacf5585d 100644 --- a/Makefile +++ b/Makefile @@ -21,15 +21,15 @@ default: deps: bash -c "./scripts/deps.sh" test: - export PULSE_PATH=`pwd`/build; bash -c "./scripts/test.sh" + export SNAP_PATH=`pwd`/build; bash -c "./scripts/test.sh" check: $(MAKE) test all: bash -c "./scripts/build.sh $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) true" -pulse: +snap: bash -c "./scripts/build.sh $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))" install: - cp build/bin/pulsed /usr/local/bin/ - cp build/bin/pulsectl /usr/local/bin/ + cp build/bin/snapd /usr/local/bin/ + cp build/bin/snapctl /usr/local/bin/ release: bash -c "./scripts/release.sh $(TAG) $(COMMIT)" diff --git a/NOTICE b/NOTICE deleted file mode 100644 index dc750391d..000000000 --- a/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache pulse -Copyright 2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file diff --git a/README.md b/README.md index 9ea2e5ada..1436744cf 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -# **Pulse** _A powerful telemetry agent framework_ -[![Build Status](https://magnum.travis-ci.com/intelsdi-x/pulse.svg?token=2ujsxEpZo1issFyVWX29&branch=master)](https://magnum.travis-ci.com/intelsdi-x/pulse) +# **snap** _A powerful telemetry agent framework_ +[![Build Status](https://magnum.travis-ci.com/intelsdi-x/snap.svg?token=2ujsxEpZo1issFyVWX29&branch=master)](https://magnum.travis-ci.com/intelsdi-x/snap) - [ ] TODO: Consider branching note ([like this one](https://github.com/Netflix/genie#in-active-development)) @@ -26,7 +26,7 @@ limitations under the License. 2. [Getting Started](#getting-started) * [System Requirements](#system-requirements) * [Installation](#installation) - * [Running Pulse](#running-pulse) + * [Running snap](#running-snap) * [Load Plugins](#load-plugins) * [Running Tasks](#running-tasks) * [Building Tasks](#building-tasks) @@ -43,7 +43,7 @@ limitations under the License. ## Overview -**Pulse** is a framework for enabling the gathering of telemetry from systems. The goals of this project are to: +**snap** is a framework for enabling the gathering of telemetry from systems. The goals of this project are to: * Empower systems to expose a consistent set of telemetry data * Simplify telemetry ingestion across ubiquitous storage system @@ -51,72 +51,72 @@ limitations under the License. * Allow flexible processing of telemetry data on agent (e.g. machine learning) * Provide powerful clustered control of telemetry workflows across small or large clusters -The key features of Pulse are: +The key features of snap are: -* **Plugin Architecture**: Pulse has a simple and smart modular design. The three types of plugins (collectors, processors, and publishers) allow Pulse to mix and match functionality based on user need. All plugins are designed with versioning, signing and deployment at scale in mind. The open plugin model allows for loading built-in, community, or proprietary plugins into Pulse. +* **Plugin Architecture**: snap has a simple and smart modular design. The three types of plugins (collectors, processors, and publishers) allow snap to mix and match functionality based on user need. All plugins are designed with versioning, signing and deployment at scale in mind. The open plugin model allows for loading built-in, community, or proprietary plugins into snap. * **Collectors** - Collectors consume telemetry data. Collectors are built-in plugins for leveraging existing telemetry solutions (Facter, CollectD, Ohai) as well as specific plugins for consuming Intel telemetry (Node, DCM, NIC, Disk) and can reach into new architectures through additional plugins (see [Plugin Authoring below](#)). Telemetry data is organized into a dynamically generated catalog of available data points. * **Processors** - Extensible workflow injection. Convert telemetry into another data model for consumption by existing consumption systems (like OpenStack Ceilometer). Allows encryption of all or part of the telemetry payload before publishing. Inject remote queries into workflow for tokens, filtering, or other external calls. Implement filtering at an agent level reducing injection load on telemetry consumer. - * **Publishers** - Store telemetry into a wide array of systems. Pulse decouples the collection of telemetry from the implementation of where to send it. Pulse comes with a large library of publisher plugins that allow exposure to telemetry analytics systems both custom and common. This flexibility allows Pulse to be valuable to open source and commercial ecosystems alike by writing a publisher for their architectures. + * **Publishers** - Store telemetry into a wide array of systems. snap decouples the collection of telemetry from the implementation of where to send it. snap comes with a large library of publisher plugins that allow exposure to telemetry analytics systems both custom and common. This flexibility allows snap to be valuable to open source and commercial ecosystems alike by writing a publisher for their architectures. -* **Dynamic Updates**: Pulse is designed to evolve. Each scheduled workflow automatically uses the most mature plugin for that step, unless the collection is pinned to a specific version (ex: get /intel/server/cpu/load/v1). Loading a new plugin automatically upgrades running workflows in tasks. Load plugins dynamically, without a restart to the service or server. This dynamically extends the metric catalog when loaded, giving access to new measurements immediately. Swapping a newer version plugin for an old one in a safe transaction. All of these behaviors allow for simple and secure bug fixes, security patching, and improving accuracy in production. +* **Dynamic Updates**: snap is designed to evolve. Each scheduled workflow automatically uses the most mature plugin for that step, unless the collection is pinned to a specific version (ex: get /intel/server/cpu/load/v1). Loading a new plugin automatically upgrades running workflows in tasks. Load plugins dynamically, without a restart to the service or server. This dynamically extends the metric catalog when loaded, giving access to new measurements immediately. Swapping a newer version plugin for an old one in a safe transaction. All of these behaviors allow for simple and secure bug fixes, security patching, and improving accuracy in production. -* **Pulse Tribe**: Pulse is designed for ease of administration. With Pulse Tribe, nodes work in groups (aka tribes). Requests are made through agreement- or task-based node groups, designed as a scalable gossip-based node-to-node communication process. Administrators can control all Pulse nodes in a tribe agreement by messaging just one of them. There is auto-discovery of new nodes and import of tasks & plugins from nodes within a given tribe. It is cluster configuration management made simple. +* **snap Tribe**: snap is designed for ease of administration. With snap Tribe, nodes work in groups (aka tribes). Requests are made through agreement- or task-based node groups, designed as a scalable gossip-based node-to-node communication process. Administrators can control all snap nodes in a tribe agreement by messaging just one of them. There is auto-discovery of new nodes and import of tasks & plugins from nodes within a given tribe. It is cluster configuration management made simple. -Some additionally important notes about how Pulse works: +Some additionally important notes about how snap works: * Multiple management modules including: CLI, REST API, and Web Console (each of which can be turned on or off) * Secure validation occurs via plugin signing, SSL encryption for APIs and payload encryption for communication between components * CLI control from Linux or OS X -**Pulse** is not intended to: +**snap** is not intended to: * Operate as an analytics platform: the intention is to allow plugins for feeding those platforms -* Compete with existing metric/monitoring/telemetry agents: Pulse is simply a new option to use or reference +* Compete with existing metric/monitoring/telemetry agents: snap is simply a new option to use or reference ## Getting Started ### System Requirements -Pulse deploys as a binary, which makes requirements quite simple. We've tested on the following versions of linux/os x +snap deploys as a binary, which makes requirements quite simple. We've tested on the following versions of linux/os x {} ### Installation -You can get the pre-built binaries for your OS and architecture at Pulse's [Github Releases](https://github.com/intelsdi-x/pulse/releases) page. Right now, Pulse only supports Linux and OS X. +You can get the pre-built binaries for your OS and architecture at snap's [Github Releases](https://github.com/intelsdi-x/snap/releases) page. Right now, snap only supports Linux and OS X. -If you're looking for the bleeding edge of Pulse, you can build it by cloning down the `master` branch. To build Pulse from source, you will need [Golang >= 1.4](https://golang.org) and [GNU Make](https://www.gnu.org/software/make/). More on building Pulse [here](./CONTRIBUTING.md). +If you're looking for the bleeding edge of snap, you can build it by cloning down the `master` branch. To build snap from source, you will need [Golang >= 1.4](https://golang.org) and [GNU Make](https://www.gnu.org/software/make/). More on building snap [here](./CONTRIBUTING.md). -### Running Pulse +### Running snap -Start a standalone Pulse agent: +Start a standalone snap agent: ```sh -$ ./bin/pulsed --plugin-trust 0 --log-level 1 +$ ./bin/snapd --plugin-trust 0 --log-level 1 ``` -This will bring up a Pulse agent without requiring plugin signing and set the logging level to debug. Pulse's REST API will be listening on port 8181. +This will bring up a snap agent without requiring plugin signing and set the logging level to debug. snap's REST API will be listening on port 8181. ## Load Plugins -Pulse gets its power from the use of plugins. The [Plugin Catalog](#plugin-catalog) is a collection of all known plugins for Pulse. +snap gets its power from the use of plugins. The [Plugin Catalog](#plugin-catalog) is a collection of all known plugins for snap. -Next, lets load a few of the demo plugins. You can do this via cURL, or `pulsectl`, Pulse's CLI: +Next, lets load a few of the demo plugins. You can do this via cURL, or `snapctl`, snap's CLI: ```sh -curl -X POST -F plugin=@build/plugin/pulse-collector-mock1 http://localhost:8181/v1/plugins +curl -X POST -F plugin=@build/plugin/snap-collector-mock1 http://localhost:8181/v1/plugins ``` And: ```sh -$ ./bin/pulsectl plugin load build/plugin/pulse-processor-passthru -$ ./bin/pulsectl plugin load build/plugin/pulse-publisher-file +$ ./bin/snapctl plugin load build/plugin/snap-processor-passthru +$ ./bin/snapctl plugin load build/plugin/snap-publisher-file ``` Let's look at what plugins we have loaded now: ```sh -$ ./bin/pulsectl plugin list +$ ./bin/snapctl plugin list NAME VERSION TYPE SIGNED STATUS LOADED TIME mock1 1 collector false loaded Tue, 17 Nov 2015 14:08:17 PST passthru 1 processor false loaded Tue, 17 Nov 2015 14:16:12 PST @@ -127,7 +127,7 @@ file 3 publisher false loaded Next, let's start one of the [example tasks](./examples/tasks/mock-file.json) from the `examples/` directory: ``` -$ ./bin/pulsectl task create -t examples/tasks/mock-file.json +$ ./bin/snapctl task create -t examples/tasks/mock-file.json Using task manifest to create task Task created ID: 8b9babad-b3bc-4a16-9e06-1f35664a7679 @@ -142,9 +142,9 @@ See the data that is being published to the file: $ tail -f /tmp/published ``` -Or actually tap into the data that Pulse is collecting: +Or actually tap into the data that snap is collecting: ``` -$ ./bin/pulsectl task watch 8b9babad-b3bc-4a16-9e06-1f35664a7679 +$ ./bin/snapctl task watch 8b9babad-b3bc-4a16-9e06-1f35664a7679 ``` ### Building Tasks @@ -155,40 +155,40 @@ All known Plugins are tracked in the [Plugin Catalog](#()) and are tagged as con If you would like to write your own, read through [Authoring a Plugin](#). Let us know if you begin to write one by opening an Issue. When you finish, please open a Pull Request to add yours to the list! ## Documentation -Documentation for Pulse will be kept in this repository for now. We would also like to link to external how-to blog posts as people write them. See our [Contributing](#contributing) for more details. +Documentation for snap will be kept in this repository for now. We would also like to link to external how-to blog posts as people write them. See our [Contributing](#contributing) for more details. -* [Pulsectl](cmd/pulsectl/README.md) -* [Pulsed](docs/PULSED.md) +* [snapctl](cmd/snapctl/README.md) +* [snapd](docs/SNAPD.md) ### Examples -There are interesting examples of using Pulse in every plugin repository: +There are interesting examples of using snap in every plugin repository: < TODO -- move these to different repos. * [configs](examples/configs/) is a basic example of -* [tasks](examples/tasks/) has JSON-encoded execution requests for Pulse plugins +* [tasks](examples/tasks/) has JSON-encoded execution requests for snap plugins ### Roadmap ## Community Support -This repository is one of **many** projects in the **Pulse Framework**. Discuss your questions about Pulse by reaching out to us on: +This repository is one of **many** projects in the **snap Framework**. Discuss your questions about snap by reaching out to us on: -* Pulse Gitter channel (TODO Link) +* snap Gitter channel (TODO Link) * Our Google Group (TODO Link) -The full project lives here, at http://github.com/intelsdi-x/pulse. +The full project lives here, at http://github.com/intelsdi-x/snap. ## Contributing -We encourage contribution from the community. **Pulse** needs: +We encourage contribution from the community. **snap** needs: * _Feedback_: try it and tell us about it through issues, blog posts or Twitter * _Contributors_: We need plugins, schedules, testing, and more -* _Integrations_: **Pulse** can feasibly publish to almost any destination. We need publishing plugins for [Ceilometer](https://wiki.openstack.org/wiki/Ceilometer), [vCOPs](http://www.vmware.com/products/vrealize-operations), and more. See [the Plugin Catalog](./docs/PLUGIN_CATALOG.md#wish-list) for the full list +* _Integrations_: **snap** can feasibly publish to almost any destination. We need publishing plugins for [Ceilometer](https://wiki.openstack.org/wiki/Ceilometer), [vCOPs](http://www.vmware.com/products/vrealize-operations), and more. See [the Plugin Catalog](./docs/PLUGIN_CATALOG.md#wish-list) for the full list -To contribute to the Pulse framework, see [our CONTRIBUTING file](CONTRIBUTING.md). To give back to a specific plugin, open an issue on its repository. +To contribute to the snap framework, see [our CONTRIBUTING file](CONTRIBUTING.md). To give back to a specific plugin, open an issue on its repository. ## License -Pulse is an Open Source software released under the Apache 2.0 [License](LICENSE). +snap is an Open Source software released under the Apache 2.0 [License](LICENSE). ## Maintainers diff --git a/cmd/pulsectl/Godeps/Godeps.json b/cmd/snapctl/Godeps/Godeps.json similarity index 86% rename from cmd/pulsectl/Godeps/Godeps.json rename to cmd/snapctl/Godeps/Godeps.json index 6fe6488d6..c8f7dfeff 100644 --- a/cmd/pulsectl/Godeps/Godeps.json +++ b/cmd/snapctl/Godeps/Godeps.json @@ -1,5 +1,5 @@ { - "ImportPath": "github.com/intelsdi-x/pulse/cmd/pulsectl", + "ImportPath": "github.com/intelsdi-x/snap/cmd/snapctl", "GoVersion": "go1.4.2", "Deps": [ { diff --git a/cmd/pulsectl/Godeps/Readme b/cmd/snapctl/Godeps/Readme similarity index 100% rename from cmd/pulsectl/Godeps/Readme rename to cmd/snapctl/Godeps/Readme diff --git a/cmd/pulsectl/README.md b/cmd/snapctl/README.md similarity index 65% rename from cmd/pulsectl/README.md rename to cmd/snapctl/README.md index 65b7cf57f..7819e37f1 100644 --- a/cmd/pulsectl/README.md +++ b/cmd/snapctl/README.md @@ -17,16 +17,16 @@ See the License for the specific language governing permissions and limitations under the License. --> -# pulsectl +# snapctl A powerful telemetry agent framework ## Usage ``` -$PULSE_PATH/bin/pulsectl [global options] command [command options] [arguments...] +$SNAP_PATH/bin/snapctl [global options] command [command options] [arguments...] ``` ### Global Options ``` ---url, -u 'http://localhost:8181' sets the URL to use [$PULSE_URL] +--url, -u 'http://localhost:8181' sets the URL to use [$SNAP_URL] --help, -h show help --version, -v print the version ``` @@ -66,10 +66,10 @@ Example Usage ### Load and unload plugins, create and start a task -Start pulse with the REST interface enabled +Start snap with the REST interface enabled ``` -$PULSE_PATH/bin/pulsed +$SNAP_PATH/bin/snapd ``` 1. load a collector plugin @@ -82,13 +82,13 @@ $PULSE_PATH/bin/pulsed 7. unload a plugin ``` -$PULSE_PATH/bin/pulsectl plugin load $PULSE_PATH/plugin/pulse-collector-psutil -$PULSE_PATH/bin/pulsectl plugin load $PULSE_PATH/plugin/pulse-collector-mock1 -$PULSE_PATH/bin/pulsectl plugin load $PULSE_PATH/plugin/pulse-processor-passthru -$PULSE_PATH/bin/pulsectl plugin load $PULSE_PATH/plugin/pulse-publisher-influxdb -$PULSE_PATH/bin/pulsectl plugin load $PULSE_PATH/plugin/pulse-publisher-file -$PULSE_PATH/bin/pulsectl plugin list -$PULSE_PATH/bin/pulsectl task create -t $PULSE_PATH/../cmd/pulsectl/sample/psutil-influx.json -$PULSE_PATH/bin/pulsectl task list -$PULSE_PATH/bin/pulsectl plugin unload -n psutil -v 1 +$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-collector-psutil +$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-collector-mock1 +$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-processor-passthru +$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-publisher-influxdb +$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-publisher-file +$SNAP_PATH/bin/snapctl plugin list +$SNAP_PATH/bin/snapctl task create -t $SNAP_PATH/../cmd/snapctl/sample/psutil-influx.json +$SNAP_PATH/bin/snapctl task list +$SNAP_PATH/bin/snapctl plugin unload -n psutil -v 1 ``` diff --git a/cmd/pulsectl/commands.go b/cmd/snapctl/commands.go similarity index 98% rename from cmd/pulsectl/commands.go rename to cmd/snapctl/commands.go index 9db425f3a..e556dee68 100644 --- a/cmd/pulsectl/commands.go +++ b/cmd/snapctl/commands.go @@ -34,7 +34,7 @@ var ( Subcommands: []cli.Command{ { Name: "create", - Description: "Creates a new task in the pulse scheduler", + Description: "Creates a new task in the snap scheduler", Usage: "There are two ways to create a task.\n\t1) Use a task manifest with [--task-manifest]\n\t2) Provide a workflow manifest and schedule details.\n\n\t* Note: Start and stop date/time are optional.\n", Action: createTask, Flags: []cli.Flag{ diff --git a/cmd/pulsectl/config.go b/cmd/snapctl/config.go similarity index 97% rename from cmd/pulsectl/config.go rename to cmd/snapctl/config.go index 38915bc78..fcd6033ee 100644 --- a/cmd/pulsectl/config.go +++ b/cmd/snapctl/config.go @@ -25,7 +25,7 @@ import ( "text/tabwriter" "github.com/codegangsta/cli" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) func getConfig(ctx *cli.Context) { diff --git a/cmd/pulsectl/flags.go b/cmd/snapctl/flags.go similarity index 95% rename from cmd/pulsectl/flags.go rename to cmd/snapctl/flags.go index 828ee61c2..f3b80bec9 100644 --- a/cmd/pulsectl/flags.go +++ b/cmd/snapctl/flags.go @@ -27,17 +27,17 @@ var ( flURL = cli.StringFlag{ Name: "url, u", Usage: "Sets the URL to use", - EnvVar: "PULSE_URL", + EnvVar: "SNAP_URL", Value: "http://localhost:8181", } flAPIVer = cli.StringFlag{ Name: "api-version, a", - Usage: "The Pulse API version", + Usage: "The snap API version", Value: "v1", } flSecure = cli.BoolFlag{ Name: "insecure", - Usage: "Ignore certificate errors when Pulse's API is running HTTPS", + Usage: "Ignore certificate errors when snap's API is running HTTPS", } flRunning = cli.BoolFlag{ Name: "running", diff --git a/cmd/pulsectl/main.go b/cmd/snapctl/main.go similarity index 96% rename from cmd/pulsectl/main.go rename to cmd/snapctl/main.go index 630c61c05..d4fd67258 100644 --- a/cmd/pulsectl/main.go +++ b/cmd/snapctl/main.go @@ -26,7 +26,7 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/intelsdi-x/pulse/mgmt/rest/client" + "github.com/intelsdi-x/snap/mgmt/rest/client" ) var ( @@ -37,7 +37,7 @@ var ( func main() { app := cli.NewApp() - app.Name = "pulsectl" + app.Name = "snapctl" app.Version = gitversion app.Usage = "A powerful telemetry agent framework" app.Flags = []cli.Flag{flURL, flSecure, flAPIVer} diff --git a/cmd/pulsectl/metric.go b/cmd/snapctl/metric.go similarity index 100% rename from cmd/pulsectl/metric.go rename to cmd/snapctl/metric.go diff --git a/cmd/pulsectl/plugin.go b/cmd/snapctl/plugin.go similarity index 100% rename from cmd/pulsectl/plugin.go rename to cmd/snapctl/plugin.go diff --git a/cmd/pulsectl/sample/psutil-file.json b/cmd/snapctl/sample/psutil-file.json similarity index 94% rename from cmd/pulsectl/sample/psutil-file.json rename to cmd/snapctl/sample/psutil-file.json index a489bdb31..39e295ccb 100644 --- a/cmd/pulsectl/sample/psutil-file.json +++ b/cmd/snapctl/sample/psutil-file.json @@ -46,7 +46,7 @@ "plugin_name": "file", "plugin_version": 1, "config": { - "file": "/tmp/pulse-file.out" + "file": "/tmp/snap-file.out" } } ], diff --git a/cmd/pulsectl/sample/psutil-influx.json b/cmd/snapctl/sample/psutil-influx.json similarity index 97% rename from cmd/pulsectl/sample/psutil-influx.json rename to cmd/snapctl/sample/psutil-influx.json index a4e4e01e5..80f29364c 100644 --- a/cmd/pulsectl/sample/psutil-influx.json +++ b/cmd/snapctl/sample/psutil-influx.json @@ -48,7 +48,7 @@ "config": { "host": "172.16.105.128", "port": 8086, - "database": "pulse", + "database": "snap", "user": "admin", "password": "admin" } diff --git a/cmd/pulsectl/task.go b/cmd/snapctl/task.go similarity index 99% rename from cmd/pulsectl/task.go rename to cmd/snapctl/task.go index 29dc42d2c..f6b04063f 100644 --- a/cmd/pulsectl/task.go +++ b/cmd/snapctl/task.go @@ -34,8 +34,8 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/intelsdi-x/pulse/mgmt/rest/client" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/mgmt/rest/client" + "github.com/intelsdi-x/snap/scheduler/wmap" "github.com/ghodss/yaml" ) diff --git a/cmd/pulsectl/tribe.go b/cmd/snapctl/tribe.go similarity index 98% rename from cmd/pulsectl/tribe.go rename to cmd/snapctl/tribe.go index fda695ad7..a8d9a7b04 100644 --- a/cmd/pulsectl/tribe.go +++ b/cmd/snapctl/tribe.go @@ -28,7 +28,7 @@ import ( "text/tabwriter" "github.com/codegangsta/cli" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" ) func listMembers(ctx *cli.Context) { diff --git a/control/available_plugin.go b/control/available_plugin.go index 83fc54054..c1e18bbef 100644 --- a/control/available_plugin.go +++ b/control/available_plugin.go @@ -34,11 +34,11 @@ import ( log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/client" - "github.com/intelsdi-x/pulse/control/routing" - "github.com/intelsdi-x/pulse/core/control_event" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/client" + "github.com/intelsdi-x/snap/control/routing" + "github.com/intelsdi-x/snap/core/control_event" + "github.com/intelsdi-x/snap/core/perror" ) const ( @@ -295,7 +295,7 @@ type apPool struct { // The plugins in the pool. // the primary key is an increasing --> uint from - // pulsed epoch (`service pulsed start`). + // snapd epoch (`service snapd start`). plugins map[uint32]*availablePlugin pidCounter uint32 @@ -481,7 +481,7 @@ func (p *apPool) subscriptionCount() int { return len(p.subs) } -func (p *apPool) selectAP(strat RoutingStrategy) (*availablePlugin, perror.PulseError) { +func (p *apPool) selectAP(strat RoutingStrategy) (*availablePlugin, perror.SnapError) { p.RLock() defer p.RUnlock() @@ -574,7 +574,7 @@ func (ap *availablePlugins) insert(pl *availablePlugin) error { return nil } -func (ap *availablePlugins) getPool(key string) (*apPool, perror.PulseError) { +func (ap *availablePlugins) getPool(key string) (*apPool, perror.SnapError) { ap.RLock() defer ap.RUnlock() pool, ok := ap.table[key] @@ -603,7 +603,7 @@ func (ap *availablePlugins) getPool(key string) (*apPool, perror.PulseError) { return pool, nil } -func (ap *availablePlugins) holdPool(key string) (*apPool, perror.PulseError) { +func (ap *availablePlugins) holdPool(key string) (*apPool, perror.SnapError) { pool, err := ap.getPool(key) if err != nil { return nil, err @@ -615,7 +615,7 @@ func (ap *availablePlugins) holdPool(key string) (*apPool, perror.PulseError) { return pool, nil } -func (ap *availablePlugins) findLatestPool(pType, name string) (*apPool, perror.PulseError) { +func (ap *availablePlugins) findLatestPool(pType, name string) (*apPool, perror.SnapError) { // see if there exists a pool at all which matches name version. var latest *apPool for key, pool := range ap.table { @@ -652,7 +652,7 @@ func (ap *availablePlugins) getOrCreatePool(key string) (*apPool, error) { return pool, nil } -func (ap *availablePlugins) selectAP(key string) (*availablePlugin, perror.PulseError) { +func (ap *availablePlugins) selectAP(key string) (*availablePlugin, perror.SnapError) { ap.RLock() defer ap.RUnlock() diff --git a/control/available_plugin_test.go b/control/available_plugin_test.go index 5d058c74d..13cc46f50 100644 --- a/control/available_plugin_test.go +++ b/control/available_plugin_test.go @@ -24,8 +24,8 @@ import ( "net" "testing" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/routing" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/routing" . "github.com/smartystreets/goconvey/convey" ) @@ -52,7 +52,7 @@ func TestAvailablePlugin(t *testing.T) { Convey("returns nil if plugin successfully stopped", func() { r := newRunner(&routing.RoundRobinStrategy{}) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin-stop.log", + PluginLogPath: "/tmp/snap-test-plugin-stop.log", } exPlugin, _ := plugin.NewExecutablePlugin(a, PluginPath) diff --git a/control/config.go b/control/config.go index ad0de329a..5f066180b 100644 --- a/control/config.go +++ b/control/config.go @@ -28,9 +28,9 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" ) type pluginConfig struct { @@ -111,7 +111,7 @@ func (p *config) GetPluginConfigDataNodeAll() cdata.ConfigDataNode { } // UnmarshalJSON unmarshals valid json into pluginConfig. An example Config -// github.com/intelsdi-x/pulse/examples/configs/pulse-config-sample. +// github.com/intelsdi-x/snap/examples/configs/snap-config-sample. func (p *pluginConfig) UnmarshalJSON(data []byte) error { t := map[string]interface{}{} dec := json.NewDecoder(bytes.NewReader(data)) diff --git a/control/config_test.go b/control/config_test.go index 1ad6206c1..cd3bfd159 100644 --- a/control/config_test.go +++ b/control/config_test.go @@ -24,9 +24,9 @@ import ( "io/ioutil" "testing" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) @@ -61,7 +61,7 @@ func TestPluginConfig(t *testing.T) { Convey("Provided a config in json", t, func() { cfg := NewConfig() - b, err := ioutil.ReadFile("../examples/configs/pulse-config-sample.json") + b, err := ioutil.ReadFile("../examples/configs/snap-config-sample.json") So(b, ShouldNotBeEmpty) So(b, ShouldNotBeNil) So(err, ShouldBeNil) diff --git a/control/control.go b/control/control.go index 89a01ca8f..38664b79a 100644 --- a/control/control.go +++ b/control/control.go @@ -35,16 +35,16 @@ import ( log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/client" - "github.com/intelsdi-x/pulse/control/routing" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/control_event" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/pkg/aci" - "github.com/intelsdi-x/pulse/pkg/psigning" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/client" + "github.com/intelsdi-x/snap/control/routing" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/control_event" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/pkg/aci" + "github.com/intelsdi-x/snap/pkg/psigning" ) // Plugin token = token generated by plugin and passed to control @@ -102,24 +102,24 @@ type managesPlugins interface { teardown() get(string) (*loadedPlugin, error) all() map[string]*loadedPlugin - LoadPlugin(*pluginDetails, gomit.Emitter) (*loadedPlugin, perror.PulseError) - UnloadPlugin(core.Plugin) (*loadedPlugin, perror.PulseError) + LoadPlugin(*pluginDetails, gomit.Emitter) (*loadedPlugin, perror.SnapError) + UnloadPlugin(core.Plugin) (*loadedPlugin, perror.SnapError) SetMetricCatalog(catalogsMetrics) GenerateArgs(pluginPath string) plugin.Arg SetPluginConfig(*pluginConfig) } type catalogsMetrics interface { - Get([]string, int) (*metricType, perror.PulseError) + Get([]string, int) (*metricType, perror.SnapError) Add(*metricType) AddLoadedMetricType(*loadedPlugin, core.Metric) RmUnloadedPluginMetrics(lp *loadedPlugin) - Fetch([]string) ([]*metricType, perror.PulseError) + Fetch([]string) ([]*metricType, perror.SnapError) Item() (string, []*metricType) Next() bool - Subscribe([]string, int) perror.PulseError - Unsubscribe([]string, int) perror.PulseError - GetPlugin([]string, int) (*loadedPlugin, perror.PulseError) + Subscribe([]string, int) perror.SnapError + Unsubscribe([]string, int) perror.SnapError + GetPlugin([]string, int) (*loadedPlugin, perror.SnapError) } type managesSigning interface { @@ -255,7 +255,7 @@ func (p *pluginControl) Stop() { // Load is the public method to load a plugin into // the LoadedPlugins array and issue an event when // successful. -func (p *pluginControl) Load(rp *core.RequestedPlugin) (core.CatalogedPlugin, perror.PulseError) { +func (p *pluginControl) Load(rp *core.RequestedPlugin) (core.CatalogedPlugin, perror.SnapError) { f := map[string]interface{}{ "_block": "load", } @@ -298,7 +298,7 @@ func (p *pluginControl) Load(rp *core.RequestedPlugin) (core.CatalogedPlugin, pe return pl, nil } -func (p *pluginControl) verifySignature(rp *core.RequestedPlugin) (bool, perror.PulseError) { +func (p *pluginControl) verifySignature(rp *core.RequestedPlugin) (bool, perror.SnapError) { f := map[string]interface{}{ "_block": "verifySignature", } @@ -325,9 +325,9 @@ func (p *pluginControl) verifySignature(rp *core.RequestedPlugin) (bool, perror. } -func (p *pluginControl) returnPluginDetails(rp *core.RequestedPlugin) (*pluginDetails, perror.PulseError) { +func (p *pluginControl) returnPluginDetails(rp *core.RequestedPlugin) (*pluginDetails, perror.SnapError) { details := &pluginDetails{} - var perr perror.PulseError + var perr perror.SnapError //Check plugin signing details.Signed, perr = p.verifySignature(rp) if perr != nil { @@ -366,7 +366,7 @@ func (p *pluginControl) returnPluginDetails(rp *core.RequestedPlugin) (*pluginDe return details, nil } -func (p *pluginControl) Unload(pl core.Plugin) (core.CatalogedPlugin, perror.PulseError) { +func (p *pluginControl) Unload(pl core.Plugin) (core.CatalogedPlugin, perror.SnapError) { up, err := p.pluginManager.UnloadPlugin(pl) if err != nil { return nil, err @@ -381,7 +381,7 @@ func (p *pluginControl) Unload(pl core.Plugin) (core.CatalogedPlugin, perror.Pul return up, nil } -func (p *pluginControl) SwapPlugins(in *core.RequestedPlugin, out core.CatalogedPlugin) perror.PulseError { +func (p *pluginControl) SwapPlugins(in *core.RequestedPlugin, out core.CatalogedPlugin) perror.SnapError { details, perr := p.returnPluginDetails(in) if perr != nil { @@ -422,8 +422,8 @@ func (p *pluginControl) SwapPlugins(in *core.RequestedPlugin, out core.Cataloged return nil } -func (p *pluginControl) ValidateDeps(mts []core.Metric, plugins []core.SubscribedPlugin) []perror.PulseError { - var perrs []perror.PulseError +func (p *pluginControl) ValidateDeps(mts []core.Metric, plugins []core.SubscribedPlugin) []perror.SnapError { + var perrs []perror.SnapError for _, mt := range mts { _, errs := p.validateMetricTypeSubscription(mt, mt.Config()) if len(errs) > 0 { @@ -438,7 +438,7 @@ func (p *pluginControl) ValidateDeps(mts []core.Metric, plugins []core.Subscribe for _, plg := range plugins { typ, err := core.ToPluginType(plg.TypeName()) if err != nil { - return []perror.PulseError{perror.New(err)} + return []perror.SnapError{perror.New(err)} } plg.Config().Merge(p.Config.Plugins.getPluginConfigDataNode(typ, plg.Name(), plg.Version())) errs := p.validatePluginSubscription(plg) @@ -451,8 +451,8 @@ func (p *pluginControl) ValidateDeps(mts []core.Metric, plugins []core.Subscribe return perrs } -func (p *pluginControl) validatePluginSubscription(pl core.SubscribedPlugin) []perror.PulseError { - var perrs = []perror.PulseError{} +func (p *pluginControl) validatePluginSubscription(pl core.SubscribedPlugin) []perror.SnapError { + var perrs = []perror.SnapError{} controlLogger.WithFields(log.Fields{ "_block": "validate-plugin-subscription", "plugin": fmt.Sprintf("%s:%d", pl.Name(), pl.Version()), @@ -483,8 +483,8 @@ func (p *pluginControl) validatePluginSubscription(pl core.SubscribedPlugin) []p return perrs } -func (p *pluginControl) validateMetricTypeSubscription(mt core.RequestedMetric, cd *cdata.ConfigDataNode) (core.Metric, []perror.PulseError) { - var perrs []perror.PulseError +func (p *pluginControl) validateMetricTypeSubscription(mt core.RequestedMetric, cd *cdata.ConfigDataNode) (core.Metric, []perror.SnapError) { + var perrs []perror.SnapError controlLogger.WithFields(log.Fields{ "_block": "validate-metric-subscription", "namespace": mt.Namespace(), @@ -507,7 +507,7 @@ func (p *pluginControl) validateMetricTypeSubscription(mt core.RequestedMetric, typ, perr := core.ToPluginType(m.Plugin.TypeName()) if perr != nil { - return nil, []perror.PulseError{perror.New(err)} + return nil, []perror.SnapError{perror.New(err)} } // merge global plugin config @@ -538,10 +538,10 @@ func (p *pluginControl) validateMetricTypeSubscription(mt core.RequestedMetric, return m, perrs } -func (p *pluginControl) gatherCollectors(mts []core.Metric) ([]core.Plugin, []perror.PulseError) { +func (p *pluginControl) gatherCollectors(mts []core.Metric) ([]core.Plugin, []perror.SnapError) { var ( plugins []core.Plugin - perrs []perror.PulseError + perrs []perror.SnapError ) // here we resolve and retrieve plugins for each metric type. @@ -578,8 +578,8 @@ func (p *pluginControl) gatherCollectors(mts []core.Metric) ([]core.Plugin, []pe return plugins, nil } -func (p *pluginControl) SubscribeDeps(taskId string, mts []core.Metric, plugins []core.Plugin) []perror.PulseError { - var perrs []perror.PulseError +func (p *pluginControl) SubscribeDeps(taskId string, mts []core.Metric, plugins []core.Plugin) []perror.SnapError { + var perrs []perror.SnapError collectors, errs := p.gatherCollectors(mts) if len(errs) > 0 { @@ -665,7 +665,7 @@ func (p *pluginControl) verifyPlugin(lp *loadedPlugin) error { return nil } -func (p *pluginControl) sendPluginSubscriptionEvent(taskId string, pl core.Plugin) perror.PulseError { +func (p *pluginControl) sendPluginSubscriptionEvent(taskId string, pl core.Plugin) perror.SnapError { pt, err := core.ToPluginType(pl.TypeName()) if err != nil { return perror.New(err) @@ -686,8 +686,8 @@ func (p *pluginControl) sendPluginSubscriptionEvent(taskId string, pl core.Plugi return nil } -func (p *pluginControl) UnsubscribeDeps(taskId string, mts []core.Metric, plugins []core.Plugin) []perror.PulseError { - var perrs []perror.PulseError +func (p *pluginControl) UnsubscribeDeps(taskId string, mts []core.Metric, plugins []core.Plugin) []perror.SnapError { + var perrs []perror.SnapError collectors, errs := p.gatherCollectors(mts) if len(errs) > 0 { @@ -713,7 +713,7 @@ func (p *pluginControl) UnsubscribeDeps(taskId string, mts []core.Metric, plugin return perrs } -func (p *pluginControl) sendPluginUnsubscriptionEvent(taskId string, pl core.Plugin) perror.PulseError { +func (p *pluginControl) sendPluginUnsubscriptionEvent(taskId string, pl core.Plugin) perror.SnapError { pt, err := core.ToPluginType(pl.TypeName()) if err != nil { return perror.New(err) diff --git a/control/control_test.go b/control/control_test.go index 378bc7ad7..3af118bce 100644 --- a/control/control_test.go +++ b/control/control_test.go @@ -33,13 +33,13 @@ import ( . "github.com/smartystreets/goconvey/convey" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/control_event" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/control_event" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" ) // Mock Executor used to test @@ -58,10 +58,10 @@ type MockPluginManagerBadSwap struct { loadedPlugins *loadedPlugins } -func (m *MockPluginManagerBadSwap) LoadPlugin(*pluginDetails, gomit.Emitter) (*loadedPlugin, perror.PulseError) { +func (m *MockPluginManagerBadSwap) LoadPlugin(*pluginDetails, gomit.Emitter) (*loadedPlugin, perror.SnapError) { return new(loadedPlugin), nil } -func (m *MockPluginManagerBadSwap) UnloadPlugin(c core.Plugin) (*loadedPlugin, perror.PulseError) { +func (m *MockPluginManagerBadSwap) UnloadPlugin(c core.Plugin) (*loadedPlugin, perror.SnapError) { return nil, perror.New(errors.New("fake")) } func (m *MockPluginManagerBadSwap) get(string) (*loadedPlugin, error) { return nil, nil } @@ -75,11 +75,11 @@ func (m *MockPluginManagerBadSwap) all() map[string]*loadedPlugin { return m.loadedPlugins.table } -func load(c *pluginControl, paths ...string) (core.CatalogedPlugin, perror.PulseError) { +func load(c *pluginControl, paths ...string) (core.CatalogedPlugin, perror.SnapError) { // This is a Travis optimized loading of plugins. From time to time, tests will error in Travis // due to a timeout when waiting for a response from a plugin. We are going to attempt loading a plugin // 3 times before letting the error through. Hopefully this cuts down on the number of Travis failures - var e perror.PulseError + var e perror.SnapError var p core.CatalogedPlugin rp, _ := core.NewRequestedPlugin(paths[0]) if len(paths) > 1 { @@ -116,7 +116,7 @@ func TestPluginControlGenerateArgs(t *testing.T) { } func TestSwapPlugin(t *testing.T) { - if PulsePath != "" { + if SnapPath != "" { c := New() c.Start() time.Sleep(100 * time.Millisecond) @@ -143,7 +143,7 @@ func TestSwapPlugin(t *testing.T) { So(c.PluginCatalog()[0].Name(), ShouldEqual, "mock2") }) }) - mock1Path := strings.Replace(PluginPath, "pulse-collector-mock2", "pulse-collector-mock1", 1) + mock1Path := strings.Replace(PluginPath, "snap-collector-mock2", "snap-collector-mock1", 1) mockRP, _ := core.NewRequestedPlugin(mock1Path) err := c.SwapPlugins(mockRP, c.PluginCatalog()[0]) <-lpe.done @@ -245,8 +245,8 @@ func (l *listenToPluginEvent) HandleGomitEvent(e gomit.Event) { } var ( - AciPath = path.Join(strings.TrimRight(PulsePath, "build"), "pkg/unpackage/") - AciFile = "pulse-collector-plugin-mock1.darwin-x86_64.aci" + AciPath = path.Join(strings.TrimRight(SnapPath, "build"), "pkg/unpackage/") + AciFile = "snap-collector-plugin-mock1.darwin-x86_64.aci" ) type mocksigningManager struct { @@ -262,10 +262,10 @@ func (ps *mocksigningManager) ValidateSignature([]string, string, []byte) error // Uses the mock collector plugin to simulate Loading func TestLoad(t *testing.T) { - // These tests only work if PULSE_PATH is known. + // These tests only work if SNAP_PATH is known. // It is the responsibility of the testing framework to // build the plugins first into the build dir. - if PulsePath != "" { + if SnapPath != "" { c := New() // Testing trying to load before starting pluginControl @@ -313,12 +313,12 @@ func TestLoad(t *testing.T) { c.Stop() time.Sleep(100 * time.Millisecond) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } func TestLoadWithSignedPlugins(t *testing.T) { - if PulsePath != "" { + if SnapPath != "" { Convey("pluginControl.Load should successufully load a signed plugin with trust enabled", t, func() { c := New() c.pluginTrust = PluginTrustEnabled @@ -362,15 +362,15 @@ func TestLoadWithSignedPlugins(t *testing.T) { }) }) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } func TestUnload(t *testing.T) { - // These tests only work if PULSE_PATH is known. + // These tests only work if SNAP_PATH is known. // It is the responsibility of the testing framework to // build the plugins first into the build dir. - if PulsePath != "" { + if SnapPath != "" { c := New() lpe := newListenToPluginEvent() c.eventManager.RegisterHandler("TestUnload", lpe) @@ -428,7 +428,7 @@ func TestUnload(t *testing.T) { c.Stop() time.Sleep(100 * time.Millisecond) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } @@ -556,7 +556,7 @@ type mc struct { e int } -func (m *mc) Fetch(ns []string) ([]*metricType, perror.PulseError) { +func (m *mc) Fetch(ns []string) ([]*metricType, perror.SnapError) { if m.e == 2 { return nil, perror.New(errors.New("test")) } @@ -567,11 +567,11 @@ func (m *mc) resolvePlugin(mns []string, ver int) (*loadedPlugin, error) { return nil, nil } -func (m *mc) GetPlugin([]string, int) (*loadedPlugin, perror.PulseError) { +func (m *mc) GetPlugin([]string, int) (*loadedPlugin, perror.SnapError) { return nil, nil } -func (m *mc) Get(ns []string, ver int) (*metricType, perror.PulseError) { +func (m *mc) Get(ns []string, ver int) (*metricType, perror.SnapError) { if m.e == 1 { return &metricType{ policy: &mockCDProc{}, @@ -580,14 +580,14 @@ func (m *mc) Get(ns []string, ver int) (*metricType, perror.PulseError) { return nil, perror.New(errorMetricNotFound(ns)) } -func (m *mc) Subscribe(ns []string, ver int) perror.PulseError { +func (m *mc) Subscribe(ns []string, ver int) perror.SnapError { if ns[0] == "nf" { return perror.New(errorMetricNotFound(ns)) } return nil } -func (m *mc) Unsubscribe(ns []string, ver int) perror.PulseError { +func (m *mc) Unsubscribe(ns []string, ver int) perror.SnapError { if ns[0] == "nf" { return perror.New(errorMetricNotFound(ns)) } @@ -1023,7 +1023,7 @@ func TestPublishMetrics(t *testing.T) { time.Sleep(1 * time.Second) // Load plugin - _, err := load(c, path.Join(PulsePath, "plugin", "pulse-publisher-file")) + _, err := load(c, path.Join(SnapPath, "plugin", "snap-publisher-file")) <-lpe.done So(err, ShouldBeNil) So(len(c.pluginManager.all()), ShouldEqual, 1) @@ -1034,7 +1034,7 @@ func TestPublishMetrics(t *testing.T) { Convey("Subscribe to file publisher with good config", func() { n := cdata.NewNode() - config.Plugins.Publisher.Plugins[lp.Name()] = newPluginConfigItem(optAddPluginConfigItem("file", ctypes.ConfigValueStr{Value: "/tmp/pulse-TestPublishMetrics.out"})) + config.Plugins.Publisher.Plugins[lp.Name()] = newPluginConfigItem(optAddPluginConfigItem("file", ctypes.ConfigValueStr{Value: "/tmp/snap-TestPublishMetrics.out"})) pool, errp := c.pluginRunner.AvailablePlugins().getOrCreatePool("publisher:file:3") So(errp, ShouldBeNil) pool.subscribe("1", unboundSubscriptionType) @@ -1049,7 +1049,7 @@ func TestPublishMetrics(t *testing.T) { var buf bytes.Buffer enc := gob.NewEncoder(&buf) enc.Encode(metrics) - contentType := plugin.PulseGOBContentType + contentType := plugin.SnapGOBContentType errs := c.PublishMetrics(contentType, buf.Bytes(), "file", 3, n.Table()) So(errs, ShouldBeNil) ap := c.AvailablePlugins() @@ -1077,7 +1077,7 @@ func TestProcessMetrics(t *testing.T) { c.Config.Plugins.Processor.Plugins["passthru"] = newPluginConfigItem(optAddPluginConfigItem("test", ctypes.ConfigValueBool{Value: true})) // Load plugin - _, err := load(c, path.Join(PulsePath, "plugin", "pulse-processor-passthru")) + _, err := load(c, path.Join(SnapPath, "plugin", "snap-processor-passthru")) <-lpe.done So(err, ShouldBeNil) So(len(c.pluginManager.all()), ShouldEqual, 1) @@ -1102,7 +1102,7 @@ func TestProcessMetrics(t *testing.T) { var buf bytes.Buffer enc := gob.NewEncoder(&buf) enc.Encode(metrics) - contentType := plugin.PulseGOBContentType + contentType := plugin.SnapGOBContentType _, ct, errs := c.ProcessMetrics(contentType, buf.Bytes(), "passthru", 1, n.Table()) So(errs, ShouldBeEmpty) mts := []plugin.PluginMetricType{} diff --git a/control/metrics.go b/control/metrics.go index dd524ebe0..13447c8a0 100644 --- a/control/metrics.go +++ b/control/metrics.go @@ -26,11 +26,11 @@ import ( "sync" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" ) var ( @@ -111,7 +111,7 @@ func (m *metricType) Subscribe() { m.subscriptions++ } -func (m *metricType) Unsubscribe() perror.PulseError { +func (m *metricType) Unsubscribe() perror.SnapError { if m.subscriptions == 0 { return errNegativeSubCount } @@ -210,14 +210,14 @@ func (mc *metricCatalog) Add(m *metricType) { // Get retrieves a loadedPlugin given a namespace and version. // If provided a version of -1 the latest plugin will be returned. -func (mc *metricCatalog) Get(ns []string, version int) (*metricType, perror.PulseError) { +func (mc *metricCatalog) Get(ns []string, version int) (*metricType, perror.SnapError) { mc.mutex.Lock() defer mc.mutex.Unlock() return mc.get(ns, version) } // Fetch transactionally retrieves all metrics which fall under namespace ns -func (mc *metricCatalog) Fetch(ns []string) ([]*metricType, perror.PulseError) { +func (mc *metricCatalog) Fetch(ns []string) ([]*metricType, perror.SnapError) { mc.mutex.Lock() defer mc.mutex.Unlock() @@ -260,7 +260,7 @@ func (mc *metricCatalog) Next() bool { } // Subscribe atomically increments a metric's subscription count in the table. -func (mc *metricCatalog) Subscribe(ns []string, version int) perror.PulseError { +func (mc *metricCatalog) Subscribe(ns []string, version int) perror.SnapError { mc.mutex.Lock() defer mc.mutex.Unlock() @@ -274,7 +274,7 @@ func (mc *metricCatalog) Subscribe(ns []string, version int) perror.PulseError { } // Unsubscribe atomically decrements a metric's count in the table -func (mc *metricCatalog) Unsubscribe(ns []string, version int) perror.PulseError { +func (mc *metricCatalog) Unsubscribe(ns []string, version int) perror.SnapError { mc.mutex.Lock() defer mc.mutex.Unlock() @@ -286,7 +286,7 @@ func (mc *metricCatalog) Unsubscribe(ns []string, version int) perror.PulseError return m.Unsubscribe() } -func (mc *metricCatalog) GetPlugin(mns []string, ver int) (*loadedPlugin, perror.PulseError) { +func (mc *metricCatalog) GetPlugin(mns []string, ver int) (*loadedPlugin, perror.SnapError) { m, err := mc.Get(mns, ver) if err != nil { return nil, err @@ -294,7 +294,7 @@ func (mc *metricCatalog) GetPlugin(mns []string, ver int) (*loadedPlugin, perror return m.Plugin, nil } -func (mc *metricCatalog) get(ns []string, ver int) (*metricType, perror.PulseError) { +func (mc *metricCatalog) get(ns []string, ver int) (*metricType, perror.SnapError) { mts, err := mc.tree.Get(ns) if err != nil { return nil, err @@ -343,7 +343,7 @@ func appendIfMissing(keys []string, ns string) []string { return append(keys, ns) } -func getVersion(c []*metricType, ver int) (*metricType, perror.PulseError) { +func getVersion(c []*metricType, ver int) (*metricType, perror.SnapError) { for _, m := range c { if m.Plugin.Version() == ver { return m, nil diff --git a/control/metrics_test.go b/control/metrics_test.go index c11597c41..05d51c168 100644 --- a/control/metrics_test.go +++ b/control/metrics_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin" + "github.com/intelsdi-x/snap/control/plugin" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/monitor_test.go b/control/monitor_test.go index fbdfcf78f..42f397b82 100644 --- a/control/monitor_test.go +++ b/control/monitor_test.go @@ -25,8 +25,8 @@ import ( "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/routing" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/routing" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/mttrie.go b/control/mttrie.go index 94dcc9090..8363671c5 100644 --- a/control/mttrie.go +++ b/control/mttrie.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" ) /* @@ -146,7 +146,7 @@ func (mtt *mttNode) Add(mt *metricType) { // Collect collects all children below a given namespace // and concatenates their metric types into a single slice -func (mtt *mttNode) Fetch(ns []string) ([]*metricType, perror.PulseError) { +func (mtt *mttNode) Fetch(ns []string) ([]*metricType, perror.SnapError) { node, err := mtt.find(ns) if err != nil { return nil, err @@ -171,7 +171,7 @@ func (mtt *mttNode) Fetch(ns []string) ([]*metricType, perror.PulseError) { } // Remove removes all children below a given namespace -func (mtt *mttNode) Remove(ns []string) perror.PulseError { +func (mtt *mttNode) Remove(ns []string) perror.SnapError { _, err := mtt.find(ns) if err != nil { return err @@ -189,7 +189,7 @@ func (mtt *mttNode) Remove(ns []string) perror.PulseError { // Get works like fetch, but only returns the MT at the given node // and does not gather the node's children. -func (mtt *mttNode) Get(ns []string) ([]*metricType, perror.PulseError) { +func (mtt *mttNode) Get(ns []string) ([]*metricType, perror.SnapError) { node, err := mtt.find(ns) if err != nil { return nil, err @@ -226,7 +226,7 @@ func (mtt *mttNode) walk(ns []string) (*mttNode, int) { return parent, len(ns) } -func (mtt *mttNode) find(ns []string) (*mttNode, perror.PulseError) { +func (mtt *mttNode) find(ns []string) (*mttNode, perror.SnapError) { node, index := mtt.walk(ns) if index != len(ns) { pe := perror.New(errorMetricNotFound(ns)) diff --git a/control/plugin/client/cache.go b/control/plugin/client/cache.go index b70216c0b..d37783c08 100644 --- a/control/plugin/client/cache.go +++ b/control/plugin/client/cache.go @@ -25,8 +25,8 @@ import ( "time" log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/pkg/chrono" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/pkg/chrono" ) // the time limit for which a cache entry is valid. diff --git a/control/plugin/client/cache_test.go b/control/plugin/client/cache_test.go index ac0b4dd7e..72e046ed5 100644 --- a/control/plugin/client/cache_test.go +++ b/control/plugin/client/cache_test.go @@ -25,8 +25,8 @@ import ( . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/pkg/chrono" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/pkg/chrono" ) func TestCache(t *testing.T) { diff --git a/control/plugin/client/client.go b/control/plugin/client/client.go index c538d7513..fc1b90f2e 100644 --- a/control/plugin/client/client.go +++ b/control/plugin/client/client.go @@ -24,10 +24,10 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/ctypes" ) type PluginCacheClient interface { diff --git a/control/plugin/client/httpjsonrpc.go b/control/plugin/client/httpjsonrpc.go index ace4713d8..dac551846 100644 --- a/control/plugin/client/httpjsonrpc.go +++ b/control/plugin/client/httpjsonrpc.go @@ -32,12 +32,12 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" + "github.com/intelsdi-x/snap/control/plugin/encrypter" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/ctypes" ) var logger = log.WithField("_module", "client-httpjsonrpc") diff --git a/control/plugin/client/httpjsonrpc_test.go b/control/plugin/client/httpjsonrpc_test.go index bea67405e..da1f1be08 100644 --- a/control/plugin/client/httpjsonrpc_test.go +++ b/control/plugin/client/httpjsonrpc_test.go @@ -34,13 +34,13 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" + "github.com/intelsdi-x/snap/control/plugin/encrypter" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) @@ -304,8 +304,8 @@ func TestHTTPJSONRPC(t *testing.T) { Convey("Process metrics", func() { pmt := plugin.NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1) b, _ := json.Marshal([]plugin.PluginMetricType{*pmt}) - contentType, content, err := p.Process(plugin.PulseJSONContentType, b, nil) - So(contentType, ShouldResemble, plugin.PulseJSONContentType) + contentType, content, err := p.Process(plugin.SnapJSONContentType, b, nil) + So(contentType, ShouldResemble, plugin.SnapJSONContentType) So(content, ShouldNotBeNil) So(err, ShouldEqual, nil) var pmts []plugin.PluginMetricType @@ -344,7 +344,7 @@ func TestHTTPJSONRPC(t *testing.T) { Convey("Publish metrics", func() { pmt := plugin.NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1) b, _ := json.Marshal([]plugin.PluginMetricType{*pmt}) - err := p.Publish(plugin.PulseJSONContentType, b, nil) + err := p.Publish(plugin.SnapJSONContentType, b, nil) So(err, ShouldBeNil) }) diff --git a/control/plugin/client/native.go b/control/plugin/client/native.go index 460ab17f7..852a59a3a 100644 --- a/control/plugin/client/native.go +++ b/control/plugin/client/native.go @@ -30,13 +30,13 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" + "github.com/intelsdi-x/snap/control/plugin/encrypter" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" ) // CallsRPC provides an interface for RPC clients diff --git a/control/plugin/collector_proxy.go b/control/plugin/collector_proxy.go index 74c4322ca..e639c73d7 100644 --- a/control/plugin/collector_proxy.go +++ b/control/plugin/collector_proxy.go @@ -23,7 +23,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/core/cdata" ) // Arguments passed to CollectMetrics() for a Collector implementation diff --git a/control/plugin/collector_proxy_test.go b/control/plugin/collector_proxy_test.go index 2b8d819b1..11ec89bf5 100644 --- a/control/plugin/collector_proxy_test.go +++ b/control/plugin/collector_proxy_test.go @@ -26,9 +26,9 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" + "github.com/intelsdi-x/snap/core" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/collector_test.go b/control/plugin/collector_test.go index 1f5247f8f..bdabedfd9 100644 --- a/control/plugin/collector_test.go +++ b/control/plugin/collector_test.go @@ -22,7 +22,7 @@ package plugin import ( "testing" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/cpolicy/float.go b/control/plugin/cpolicy/float.go index fa35f08fd..d2b5c6633 100644 --- a/control/plugin/cpolicy/float.go +++ b/control/plugin/cpolicy/float.go @@ -26,7 +26,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) // FloatRule A rule validating against string-typed config diff --git a/control/plugin/cpolicy/float_test.go b/control/plugin/cpolicy/float_test.go index 00c053012..bb6f70488 100644 --- a/control/plugin/cpolicy/float_test.go +++ b/control/plugin/cpolicy/float_test.go @@ -23,7 +23,7 @@ import ( "errors" "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/cpolicy/integer.go b/control/plugin/cpolicy/integer.go index 3d8fb2976..672c85196 100644 --- a/control/plugin/cpolicy/integer.go +++ b/control/plugin/cpolicy/integer.go @@ -26,7 +26,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) // A rule validating against string-typed config diff --git a/control/plugin/cpolicy/integer_test.go b/control/plugin/cpolicy/integer_test.go index c21016177..f9e9c46a2 100644 --- a/control/plugin/cpolicy/integer_test.go +++ b/control/plugin/cpolicy/integer_test.go @@ -23,7 +23,7 @@ import ( "errors" "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/cpolicy/node.go b/control/plugin/cpolicy/node.go index f695dee4e..b593e3bdc 100644 --- a/control/plugin/cpolicy/node.go +++ b/control/plugin/cpolicy/node.go @@ -27,8 +27,8 @@ import ( "fmt" "sync" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/pkg/ctree" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/pkg/ctree" ) type ProcessingErrors struct { diff --git a/control/plugin/cpolicy/node_test.go b/control/plugin/cpolicy/node_test.go index 2e1be8d00..20194c599 100644 --- a/control/plugin/cpolicy/node_test.go +++ b/control/plugin/cpolicy/node_test.go @@ -22,7 +22,7 @@ package cpolicy import ( "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/cpolicy/rule.go b/control/plugin/cpolicy/rule.go index 6e63401ac..85dff34f4 100644 --- a/control/plugin/cpolicy/rule.go +++ b/control/plugin/cpolicy/rule.go @@ -25,7 +25,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) var ( diff --git a/control/plugin/cpolicy/string.go b/control/plugin/cpolicy/string.go index 621d07dba..c94754b1b 100644 --- a/control/plugin/cpolicy/string.go +++ b/control/plugin/cpolicy/string.go @@ -24,7 +24,7 @@ import ( "encoding/gob" "encoding/json" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) // A rule validating against string-typed config diff --git a/control/plugin/cpolicy/string_test.go b/control/plugin/cpolicy/string_test.go index 6257e6adc..98564c5d3 100644 --- a/control/plugin/cpolicy/string_test.go +++ b/control/plugin/cpolicy/string_test.go @@ -23,7 +23,7 @@ import ( "errors" "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/cpolicy/tree.go b/control/plugin/cpolicy/tree.go index 7e4c6494e..a27794a4f 100644 --- a/control/plugin/cpolicy/tree.go +++ b/control/plugin/cpolicy/tree.go @@ -24,7 +24,7 @@ import ( "encoding/gob" "encoding/json" - "github.com/intelsdi-x/pulse/pkg/ctree" + "github.com/intelsdi-x/snap/pkg/ctree" ) // Allows adding of config policy by namespace and retrieving of policy from a tree diff --git a/control/plugin/cpolicy/tree_test.go b/control/plugin/cpolicy/tree_test.go index 585f227f0..c5e802a75 100644 --- a/control/plugin/cpolicy/tree_test.go +++ b/control/plugin/cpolicy/tree_test.go @@ -23,7 +23,7 @@ import ( "encoding/gob" "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/encoding/encoding.go b/control/plugin/encoding/encoding.go index 586325a04..2a93a1dc2 100644 --- a/control/plugin/encoding/encoding.go +++ b/control/plugin/encoding/encoding.go @@ -19,7 +19,7 @@ limitations under the License. package encoding -import "github.com/intelsdi-x/pulse/control/plugin/encrypter" +import "github.com/intelsdi-x/snap/control/plugin/encrypter" type Encoder interface { Encode(interface{}) ([]byte, error) diff --git a/control/plugin/encoding/gob.go b/control/plugin/encoding/gob.go index dd3609cbb..3cff6ac59 100644 --- a/control/plugin/encoding/gob.go +++ b/control/plugin/encoding/gob.go @@ -23,7 +23,7 @@ import ( "bytes" "encoding/gob" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" + "github.com/intelsdi-x/snap/control/plugin/encrypter" ) type gobEncoder struct { diff --git a/control/plugin/encoding/json.go b/control/plugin/encoding/json.go index 67b163a79..5b7c04a78 100644 --- a/control/plugin/encoding/json.go +++ b/control/plugin/encoding/json.go @@ -23,7 +23,7 @@ import ( "bytes" "encoding/json" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" + "github.com/intelsdi-x/snap/control/plugin/encrypter" ) type jsonEncoder struct { diff --git a/control/plugin/execution_test.go b/control/plugin/execution_test.go index 9ad234222..34ee4352d 100644 --- a/control/plugin/execution_test.go +++ b/control/plugin/execution_test.go @@ -34,9 +34,9 @@ import ( ) var ( - PluginName = "pulse-collector-mock2" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) + PluginName = "snap-collector-mock2" + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) ) type MockController struct { @@ -177,13 +177,13 @@ func TestWaitForPluginResponse(t *testing.T) { }) // These tests don't mock and directly use mock collector plugin - // They require pulse path being set and a recent build of the plugin + // They require snap path being set and a recent build of the plugin // WIP if PluginPath != "" { Convey("mock", func() { m := new(MockController) a := m.GenerateArgs() - a.PluginLogPath = "/tmp/pulse-mock.log" + a.PluginLogPath = "/tmp/snap-mock.log" ex, err := NewExecutablePlugin(a, PluginPath) if err != nil { panic(err) @@ -203,7 +203,7 @@ func TestWaitForPluginResponse(t *testing.T) { Convey("mock2", func() { m := new(MockController) a := m.GenerateArgs() - a.PluginLogPath = "/tmp/pulse-mock.log" + a.PluginLogPath = "/tmp/snap-mock.log" ex, err := NewExecutablePlugin(a, PluginPath) if err != nil { panic(err) diff --git a/control/plugin/metric.go b/control/plugin/metric.go index a204e7e92..b6c8591db 100644 --- a/control/plugin/metric.go +++ b/control/plugin/metric.go @@ -29,21 +29,21 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" ) const ( // These are our built-in content types for plugins - // PulseAll the wildcard for accepting all pulse content types - PulseAllContentType = "pulse.*" - // PulseGOB pulse metrics serialized into go binary format - PulseGOBContentType = "pulse.gob" - // PulseJSON pulse metrics serialized into json - PulseJSONContentType = "pulse.json" - // PulseProtoBuff pulse metrics serialized into protocol buffers - // PulseProtoBuff = "pulse.pb" // TO BE IMPLEMENTED + // SnapAll the wildcard for accepting all snap content types + SnapAllContentType = "snap.*" + // SnapGOB snap metrics serialized into go binary format + SnapGOBContentType = "snap.gob" + // SnapJSON snap metrics serialized into json + SnapJSONContentType = "snap.json" + // SnapProtoBuff snap metrics serialized into protocol buffers + // SnapProtoBuff = "snap.pb" // TO BE IMPLEMENTED ) type PluginConfigType struct { @@ -93,7 +93,7 @@ type PluginMetricType struct { // Namespace is the identifier for a metric. Namespace_ []string `json:"namespace"` - // Last advertised time is the last time the Pulse agent was told about + // Last advertised time is the last time the snap agent was told about // a metric. LastAdvertisedTime_ time.Time `json:"last_advertised_time"` @@ -191,8 +191,8 @@ func MarshalPluginMetricTypes(contentType string, metrics []PluginMetricType) ([ } // Switch on content type switch contentType { - case PulseAllContentType, PulseGOBContentType: - // NOTE: A Pulse All wildcard will result in GOB + case SnapAllContentType, SnapGOBContentType: + // NOTE: A snap All wildcard will result in GOB var buf bytes.Buffer enc := gob.NewEncoder(&buf) err := enc.Encode(metrics) @@ -204,9 +204,9 @@ func MarshalPluginMetricTypes(contentType string, metrics []PluginMetricType) ([ }).Error("error while marshalling") return nil, "", err } - // contentType := PulseGOBContentType - return buf.Bytes(), PulseGOBContentType, nil - case PulseJSONContentType: + // contentType := SnapGOBContentType + return buf.Bytes(), SnapGOBContentType, nil + case SnapJSONContentType: // Serialize into JSON b, err := json.Marshal(metrics) if err != nil { @@ -217,10 +217,10 @@ func MarshalPluginMetricTypes(contentType string, metrics []PluginMetricType) ([ }).Error("error while marshalling") return nil, "", err } - return b, PulseJSONContentType, nil + return b, SnapJSONContentType, nil default: // We don't recognize this content type. Log and return error. - es := fmt.Sprintf("invalid pulse content type: %s", contentType) + es := fmt.Sprintf("invalid snap content type: %s", contentType) log.WithFields(log.Fields{ "_module": "control-plugin", "block": "marshal-content-type", @@ -233,7 +233,7 @@ func MarshalPluginMetricTypes(contentType string, metrics []PluginMetricType) ([ // UnmarshallPluginMetricTypes takes a content type and []byte payload and returns a []PluginMetricType func UnmarshallPluginMetricTypes(contentType string, payload []byte) ([]PluginMetricType, error) { switch contentType { - case PulseGOBContentType: + case SnapGOBContentType: var metrics []PluginMetricType r := bytes.NewBuffer(payload) err := gob.NewDecoder(r).Decode(&metrics) @@ -246,7 +246,7 @@ func UnmarshallPluginMetricTypes(contentType string, payload []byte) ([]PluginMe return nil, err } return metrics, nil - case PulseJSONContentType: + case SnapJSONContentType: var metrics []PluginMetricType err := json.Unmarshal(payload, &metrics) if err != nil { @@ -260,7 +260,7 @@ func UnmarshallPluginMetricTypes(contentType string, payload []byte) ([]PluginMe return metrics, nil default: // We don't recognize this content type as one we can unmarshal. Log and return error. - es := fmt.Sprintf("invalid pulse content type for unmarshalling: %s", contentType) + es := fmt.Sprintf("invalid snap content type for unmarshalling: %s", contentType) log.WithFields(log.Fields{ "_module": "control-plugin", "block": "unmarshal-content-type", diff --git a/control/plugin/metric_test.go b/control/plugin/metric_test.go index c363300c8..457e8cfb7 100644 --- a/control/plugin/metric_test.go +++ b/control/plugin/metric_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) func TestMetric(t *testing.T) { - Convey("error on invalid pulse content type", t, func() { + Convey("error on invalid snap content type", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, 2), @@ -42,7 +42,7 @@ func TestMetric(t *testing.T) { configNewNode.AddItem("user", ctypes.ConfigValueStr{Value: "foo"}) m[0].Config_ = configNewNode So(e, ShouldNotBeNil) - So(e.Error(), ShouldEqual, "invalid pulse content type: foo") + So(e.Error(), ShouldEqual, "invalid snap content type: foo") So(a, ShouldBeNil) So(c, ShouldEqual, "") So(m[0].Version(), ShouldResemble, 1) @@ -59,19 +59,19 @@ func TestMetric(t *testing.T) { So(c, ShouldEqual, "") }) - Convey("marshall using pulse.* default to pulse.gob", t, func() { + Convey("marshall using snap.* default to snap.gob", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.*", m) + a, c, e := MarshalPluginMetricTypes("snap.*", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.gob") + So(c, ShouldEqual, "snap.gob") - Convey("unmarshal pulse.gob", func() { - m, e = UnmarshallPluginMetricTypes("pulse.gob", a) + Convey("unmarshal snap.gob", func() { + m, e = UnmarshallPluginMetricTypes("snap.gob", a) So(e, ShouldBeNil) So(strings.Join(m[0].Namespace(), "/"), ShouldResemble, "foo/bar") So(m[0].Data(), ShouldResemble, 1) @@ -81,19 +81,19 @@ func TestMetric(t *testing.T) { }) - Convey("marshall using pulse.gob", t, func() { + Convey("marshall using snap.gob", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.gob", m) + a, c, e := MarshalPluginMetricTypes("snap.gob", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.gob") + So(c, ShouldEqual, "snap.gob") - Convey("unmarshal pulse.gob", func() { - m, e = UnmarshallPluginMetricTypes("pulse.gob", a) + Convey("unmarshal snap.gob", func() { + m, e = UnmarshallPluginMetricTypes("snap.gob", a) So(e, ShouldBeNil) So(strings.Join(m[0].Namespace(), "/"), ShouldResemble, "foo/bar") So(m[0].Data(), ShouldResemble, 1) @@ -103,25 +103,25 @@ func TestMetric(t *testing.T) { Convey("error on bad corrupt data", func() { a = []byte{1, 0, 1, 1, 1, 1, 1, 0, 0, 1} - m, e = UnmarshallPluginMetricTypes("pulse.gob", a) + m, e = UnmarshallPluginMetricTypes("snap.gob", a) So(e, ShouldNotBeNil) So(e.Error(), ShouldResemble, "gob: decoding into local type *[]plugin.PluginMetricType, received remote type unknown type") }) }) - Convey("marshall using pulse.json", t, func() { + Convey("marshall using snap.json", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.json", m) + a, c, e := MarshalPluginMetricTypes("snap.json", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.json") + So(c, ShouldEqual, "snap.json") - Convey("unmarshal pulse.json", func() { - m, e = UnmarshallPluginMetricTypes("pulse.json", a) + Convey("unmarshal snap.json", func() { + m, e = UnmarshallPluginMetricTypes("snap.json", a) So(e, ShouldBeNil) So(strings.Join(m[0].Namespace(), "/"), ShouldResemble, "foo/bar") So(m[0].Data(), ShouldResemble, float64(1)) @@ -131,7 +131,7 @@ func TestMetric(t *testing.T) { Convey("error on bad corrupt data", func() { a = []byte{1, 0, 1, 1, 1, 1, 1, 0, 0, 1} - m, e = UnmarshallPluginMetricTypes("pulse.json", a) + m, e = UnmarshallPluginMetricTypes("snap.json", a) So(e, ShouldNotBeNil) So(e.Error(), ShouldResemble, "invalid character '\\x01' looking for beginning of value") }) @@ -142,32 +142,32 @@ func TestMetric(t *testing.T) { *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.json", m) + a, c, e := MarshalPluginMetricTypes("snap.json", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.json") + So(c, ShouldEqual, "snap.json") - m, e = UnmarshallPluginMetricTypes("pulse.wat", a) + m, e = UnmarshallPluginMetricTypes("snap.wat", a) So(e, ShouldNotBeNil) - So(e.Error(), ShouldEqual, "invalid pulse content type for unmarshalling: pulse.wat") + So(e.Error(), ShouldEqual, "invalid snap content type for unmarshalling: snap.wat") So(m, ShouldBeNil) }) - Convey("swap from pulse.gob to pulse.json", t, func() { + Convey("swap from snap.gob to snap.json", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.gob", m) + a, c, e := MarshalPluginMetricTypes("snap.gob", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.gob") + So(c, ShouldEqual, "snap.gob") - b, c, e := SwapPluginMetricContentType(c, "pulse.json", a) + b, c, e := SwapPluginMetricContentType(c, "snap.json", a) So(e, ShouldBeNil) - So(c, ShouldResemble, "pulse.json") + So(c, ShouldResemble, "snap.json") So(b, ShouldNotBeNil) m, e = UnmarshallPluginMetricTypes(c, b) @@ -178,20 +178,20 @@ func TestMetric(t *testing.T) { So(m[1].Data(), ShouldResemble, "2") }) - Convey("swap from pulse.json to pulse.*", t, func() { + Convey("swap from snap.json to snap.*", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.json", m) + a, c, e := MarshalPluginMetricTypes("snap.json", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.json") + So(c, ShouldEqual, "snap.json") - b, c, e := SwapPluginMetricContentType(c, "pulse.*", a) + b, c, e := SwapPluginMetricContentType(c, "snap.*", a) So(e, ShouldBeNil) - So(c, ShouldResemble, "pulse.gob") + So(c, ShouldResemble, "snap.gob") So(b, ShouldNotBeNil) m, e = UnmarshallPluginMetricTypes(c, b) @@ -202,20 +202,20 @@ func TestMetric(t *testing.T) { So(m[1].Data(), ShouldResemble, "2") }) - Convey("swap from pulse.json to pulse.gob", t, func() { + Convey("swap from snap.json to snap.gob", t, func() { m := []PluginMetricType{ *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.json", m) + a, c, e := MarshalPluginMetricTypes("snap.json", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.json") + So(c, ShouldEqual, "snap.json") - b, c, e := SwapPluginMetricContentType(c, "pulse.gob", a) + b, c, e := SwapPluginMetricContentType(c, "snap.gob", a) So(e, ShouldBeNil) - So(c, ShouldResemble, "pulse.gob") + So(c, ShouldResemble, "snap.gob") So(b, ShouldNotBeNil) m, e = UnmarshallPluginMetricTypes(c, b) @@ -231,15 +231,15 @@ func TestMetric(t *testing.T) { *NewPluginMetricType([]string{"foo", "bar"}, time.Now(), "", nil, nil, 1), *NewPluginMetricType([]string{"foo", "baz"}, time.Now(), "", nil, nil, "2"), } - a, c, e := MarshalPluginMetricTypes("pulse.json", m) + a, c, e := MarshalPluginMetricTypes("snap.json", m) So(e, ShouldBeNil) So(a, ShouldNotBeNil) So(len(a), ShouldBeGreaterThan, 0) - So(c, ShouldEqual, "pulse.json") + So(c, ShouldEqual, "snap.json") - b, c, e := SwapPluginMetricContentType("pulse.wat", "pulse.gob", a) + b, c, e := SwapPluginMetricContentType("snap.wat", "snap.gob", a) So(e, ShouldNotBeNil) - So(e.Error(), ShouldResemble, "invalid pulse content type for unmarshalling: pulse.wat") + So(e.Error(), ShouldResemble, "invalid snap content type for unmarshalling: snap.wat") So(b, ShouldBeNil) }) } diff --git a/control/plugin/plugin.go b/control/plugin/plugin.go index 0ad109444..b199708b3 100644 --- a/control/plugin/plugin.go +++ b/control/plugin/plugin.go @@ -35,7 +35,7 @@ import ( "runtime" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" ) // Plugin type @@ -94,7 +94,7 @@ type PluginMeta struct { Type PluginType RPCType RPCType // Content types accepted by this plugin in priority order - // pulse.* means any pulse type + // snap.* means any snap type AcceptedContentTypes []string // Return content types in priority order // This is only really valid on processors @@ -133,9 +133,9 @@ func Unsecure(e bool) metaOp { // NewPluginMeta constructs and returns a PluginMeta struct func NewPluginMeta(name string, version int, pluginType PluginType, acceptContentTypes, returnContentTypes []string, opts ...metaOp) *PluginMeta { - // An empty accepted content type default to "pulse.*" + // An empty accepted content type default to "snap.*" if len(acceptContentTypes) == 0 { - acceptContentTypes = append(acceptContentTypes, "pulse.*") + acceptContentTypes = append(acceptContentTypes, "snap.*") } // Validate content type formats for _, s := range acceptContentTypes { diff --git a/control/plugin/plugin_test.go b/control/plugin/plugin_test.go index 09e38f3c0..bddf9fac6 100644 --- a/control/plugin/plugin_test.go +++ b/control/plugin/plugin_test.go @@ -57,17 +57,17 @@ func TestMetricType(t *testing.T) { func TestArg(t *testing.T) { Convey("NewArg", t, func() { - arg := NewArg("/tmp/pulse/plugin.log") + arg := NewArg("/tmp/snap/plugin.log") So(arg, ShouldNotBeNil) }) } func TestPlugin(t *testing.T) { - a := []string{PulseAllContentType} - b := []string{PulseGOBContentType} + a := []string{SnapAllContentType} + b := []string{SnapGOBContentType} Convey("Start", t, func() { mockPluginMeta := NewPluginMeta("test", 1, CollectorPluginType, a, b) - var mockPluginArgs string = "{\"PluginLogPath\": \"/var/tmp/pulse_plugin.log\"}" + var mockPluginArgs string = "{\"PluginLogPath\": \"/var/tmp/snap_plugin.log\"}" err, rc := Start(mockPluginMeta, new(MockPlugin), mockPluginArgs) So(err, ShouldBeNil) So(rc, ShouldEqual, 0) diff --git a/control/plugin/processor.go b/control/plugin/processor.go index bc51a2aef..6c2cd81d5 100644 --- a/control/plugin/processor.go +++ b/control/plugin/processor.go @@ -19,7 +19,7 @@ limitations under the License. package plugin -import "github.com/intelsdi-x/pulse/core/ctypes" +import "github.com/intelsdi-x/snap/core/ctypes" // Processor plugin type ProcessorPlugin interface { diff --git a/control/plugin/processor_proxy.go b/control/plugin/processor_proxy.go index 94195ca3e..a6dc57139 100644 --- a/control/plugin/processor_proxy.go +++ b/control/plugin/processor_proxy.go @@ -23,7 +23,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) type ProcessorArgs struct { diff --git a/control/plugin/processor_test.go b/control/plugin/processor_test.go index 23b842980..6fa2e4b4c 100644 --- a/control/plugin/processor_test.go +++ b/control/plugin/processor_test.go @@ -24,8 +24,8 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/publisher.go b/control/plugin/publisher.go index ff101b4b8..826ef19e3 100644 --- a/control/plugin/publisher.go +++ b/control/plugin/publisher.go @@ -19,7 +19,7 @@ limitations under the License. package plugin -import "github.com/intelsdi-x/pulse/core/ctypes" +import "github.com/intelsdi-x/snap/core/ctypes" // Publisher plugin type PublisherPlugin interface { diff --git a/control/plugin/publisher_proxy.go b/control/plugin/publisher_proxy.go index 7cff6315e..7dc7195cb 100644 --- a/control/plugin/publisher_proxy.go +++ b/control/plugin/publisher_proxy.go @@ -23,7 +23,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" ) type PublishArgs struct { diff --git a/control/plugin/publisher_test.go b/control/plugin/publisher_test.go index 3d2a4a6e5..fb117437c 100644 --- a/control/plugin/publisher_test.go +++ b/control/plugin/publisher_test.go @@ -24,8 +24,8 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/control/plugin/session.go b/control/plugin/session.go index 480679362..b7e03cb29 100644 --- a/control/plugin/session.go +++ b/control/plugin/session.go @@ -31,11 +31,11 @@ import ( "os" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" - "github.com/intelsdi-x/pulse/control/plugin/encrypter" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" + "github.com/intelsdi-x/snap/control/plugin/encrypter" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" ) // Session interface @@ -252,7 +252,7 @@ func NewSessionState(pluginArgsMsg string, plugin Plugin, meta *PluginMeta) (*Se truncOrAppend := os.O_TRUNC // truncate log file explicitly given by user // Empty or /tmp means use default tmp log (needs to be removed post-aAtruncOrAppendpha) if pluginArg.PluginLogPath == "" || pluginArg.PluginLogPath == "/tmp" { - pluginArg.PluginLogPath = "/tmp/pulse_plugin.log" + pluginArg.PluginLogPath = "/tmp/snap_plugin.log" truncOrAppend = os.O_APPEND } lf, err := os.OpenFile(pluginArg.PluginLogPath, os.O_WRONLY|os.O_CREATE|truncOrAppend, 0666) diff --git a/control/plugin/session_test.go b/control/plugin/session_test.go index b9a706626..0681e3942 100644 --- a/control/plugin/session_test.go +++ b/control/plugin/session_test.go @@ -27,8 +27,8 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/plugin/encoding" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/plugin/encoding" . "github.com/smartystreets/goconvey/convey" ) @@ -163,7 +163,7 @@ func TestSessionState(t *testing.T) { So(err, ShouldNotBeNil) }) Convey("InitSessionState with a custom log path", func() { - var mockPluginArgs string = "{\"RunAsDaemon\": false, \"PluginLogPath\": \"/var/tmp/pulse_plugin.log\"}" + var mockPluginArgs string = "{\"RunAsDaemon\": false, \"PluginLogPath\": \"/var/tmp/snap_plugin.log\"}" m := PluginMeta{ RPCType: JSONRPC, Type: CollectorPluginType, diff --git a/control/plugin_manager.go b/control/plugin_manager.go index f28093b14..0ad1733cf 100644 --- a/control/plugin_manager.go +++ b/control/plugin_manager.go @@ -37,11 +37,11 @@ import ( "github.com/appc/spec/schema" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/client" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/client" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" ) const ( @@ -76,7 +76,7 @@ func newLoadedPlugins() *loadedPlugins { } // add adds a loadedPlugin pointer to the table -func (l *loadedPlugins) add(lp *loadedPlugin) perror.PulseError { +func (l *loadedPlugins) add(lp *loadedPlugin) perror.SnapError { l.Lock() defer l.Unlock() @@ -147,7 +147,7 @@ func (l *loadedPlugins) findLatest(typeName, name string) (*loadedPlugin, error) return nil, ErrPluginNotFound } -// the struct representing a plugin that is loaded into Pulse +// the struct representing a plugin that is loaded into snap type pluginDetails struct { CheckSum [sha256.Size]byte Exec string @@ -254,7 +254,7 @@ func (p *pluginManager) SetMetricCatalog(mc catalogsMetrics) { // Load is the method for loading a plugin and // saving plugin into the LoadedPlugins array -func (p *pluginManager) LoadPlugin(details *pluginDetails, emitter gomit.Emitter) (*loadedPlugin, perror.PulseError) { +func (p *pluginManager) LoadPlugin(details *pluginDetails, emitter gomit.Emitter) (*loadedPlugin, perror.SnapError) { lPlugin := new(loadedPlugin) lPlugin.Details = details lPlugin.State = DetectedState @@ -428,7 +428,7 @@ func (p *pluginManager) LoadPlugin(details *pluginDetails, emitter gomit.Emitter } // unloads a plugin from the LoadedPlugins table -func (p *pluginManager) UnloadPlugin(pl core.Plugin) (*loadedPlugin, perror.PulseError) { +func (p *pluginManager) UnloadPlugin(pl core.Plugin) (*loadedPlugin, perror.SnapError) { plugin, err := p.loadedPlugins.get(fmt.Sprintf("%s:%s:%d", pl.TypeName(), pl.Name(), pl.Version())) if err != nil { diff --git a/control/plugin_manager_test.go b/control/plugin_manager_test.go index 474b5db85..ea853db0c 100644 --- a/control/plugin_manager_test.go +++ b/control/plugin_manager_test.go @@ -29,18 +29,18 @@ import ( . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" ) var ( - PluginName = "pulse-collector-mock2" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) + PluginName = "snap-collector-mock2" + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) - JSONRPC_PluginName = "pulse-collector-mock1" - JSONRPC_PluginPath = path.Join(PulsePath, "plugin", JSONRPC_PluginName) + JSONRPC_PluginName = "snap-collector-mock1" + JSONRPC_PluginPath = path.Join(SnapPath, "plugin", JSONRPC_PluginName) ) func TestLoadedPlugins(t *testing.T) { @@ -72,11 +72,11 @@ func TestLoadedPlugins(t *testing.T) { }) } -func loadPlugin(p *pluginManager, path string) (*loadedPlugin, perror.PulseError) { +func loadPlugin(p *pluginManager, path string) (*loadedPlugin, perror.SnapError) { // This is a Travis optimized loading of plugins. From time to time, tests will error in Travis // due to a timeout when waiting for a response from a plugin. We are going to attempt loading a plugin // 3 times before letting the error through. Hopefully this cuts down on the number of Travis failures - var e perror.PulseError + var e perror.SnapError var lp *loadedPlugin details := &pluginDetails{ Path: path, @@ -98,11 +98,11 @@ func loadPlugin(p *pluginManager, path string) (*loadedPlugin, perror.PulseError // Uses the mock collector plugin to simulate loading func TestLoadPlugin(t *testing.T) { - // These tests only work if PULSE_PATH is known + // These tests only work if SNAP_PATH is known // It is the responsibility of the testing framework to // build the plugins first into the build dir - if PulsePath != "" { + if SnapPath != "" { Convey("PluginManager.LoadPlugin", t, func() { Convey("loads plugin successfully", func() { @@ -173,7 +173,7 @@ func TestLoadPlugin(t *testing.T) { } func TestUnloadPlugin(t *testing.T) { - if PulsePath != "" { + if SnapPath != "" { Convey("pluginManager.UnloadPlugin", t, func() { Convey("when a loaded plugin is unloaded", func() { diff --git a/control/router.go b/control/router.go index 9f44a8c89..5bf415df1 100644 --- a/control/router.go +++ b/control/router.go @@ -20,7 +20,7 @@ limitations under the License. // Router is the entry point for execution commands and routing to plugins package control -import "github.com/intelsdi-x/pulse/control/routing" +import "github.com/intelsdi-x/snap/control/routing" type RouterResponse interface { } diff --git a/control/runner.go b/control/runner.go index 70b8be17e..c1f94e641 100644 --- a/control/runner.go +++ b/control/runner.go @@ -30,10 +30,10 @@ import ( log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/control_event" - "github.com/intelsdi-x/pulse/pkg/aci" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/control_event" + "github.com/intelsdi-x/snap/pkg/aci" ) var ( diff --git a/control/runner_test.go b/control/runner_test.go index 045bc7dde..ec36d8250 100644 --- a/control/runner_test.go +++ b/control/runner_test.go @@ -27,9 +27,9 @@ import ( "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/control/routing" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/control/routing" . "github.com/smartystreets/goconvey/convey" ) @@ -38,7 +38,7 @@ type MockController struct { func (p *MockController) GenerateArgs(daemon bool) plugin.Arg { a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", NoDaemon: daemon, } return a @@ -198,7 +198,7 @@ func TestRunnerState(t *testing.T) { // log.SetLevel(log.DebugLevel) // log.SetOutput(os.Stdout) - Convey("pulse/control", t, func() { + Convey("snap/control", t, func() { Convey("Runner", func() { @@ -342,17 +342,17 @@ func newExecutablePlugin(a plugin.Arg, path string) (*plugin.ExecutablePlugin, e func TestRunnerPluginRunning(t *testing.T) { // log.SetLevel(log.DebugLevel) - Convey("pulse/control", t, func() { + Convey("snap/control", t, func() { Convey("Runner", func() { Convey("startPlugin", func() { - // These tests only work if Pulse Path is known to discover mock plugin used for testing - if PulsePath != "" { + // These tests only work if snap Path is known to discover mock plugin used for testing + if SnapPath != "" { Convey("should return an AvailablePlugin", func() { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", // Daemon: true, } exPlugin, err := newExecutablePlugin(a, PluginPath) @@ -377,7 +377,7 @@ func TestRunnerPluginRunning(t *testing.T) { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { @@ -397,7 +397,7 @@ func TestRunnerPluginRunning(t *testing.T) { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { @@ -416,7 +416,7 @@ func TestRunnerPluginRunning(t *testing.T) { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { @@ -435,7 +435,7 @@ func TestRunnerPluginRunning(t *testing.T) { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin-foo.log", + PluginLogPath: "/tmp/snap-test-plugin-foo.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { @@ -458,7 +458,7 @@ func TestRunnerPluginRunning(t *testing.T) { r := newRunner(&routing.RoundRobinStrategy{}) r.SetEmitter(new(MockEmitter)) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin.log", + PluginLogPath: "/tmp/snap-test-plugin.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { @@ -525,7 +525,7 @@ func TestRunnerPluginRunning(t *testing.T) { Convey("should return an AvailablePlugin in a Running state", func() { r := newRunner(&routing.RoundRobinStrategy{}) a := plugin.Arg{ - PluginLogPath: "/tmp/pulse-test-plugin-stop.log", + PluginLogPath: "/tmp/snap-test-plugin-stop.log", } exPlugin, err := newExecutablePlugin(a, PluginPath) if err != nil { diff --git a/core/cdata/node.go b/core/cdata/node.go index a60be78e4..d3ea45253 100644 --- a/core/cdata/node.go +++ b/core/cdata/node.go @@ -26,8 +26,8 @@ import ( "fmt" "sync" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/pkg/ctree" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/pkg/ctree" ) // Represents a set of configuration data diff --git a/core/cdata/node_test.go b/core/cdata/node_test.go index 90e03e2b6..c5658d240 100644 --- a/core/cdata/node_test.go +++ b/core/cdata/node_test.go @@ -22,7 +22,7 @@ package cdata import ( "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/core/cdata/tree.go b/core/cdata/tree.go index 7dbc6fe1a..852beaf40 100644 --- a/core/cdata/tree.go +++ b/core/cdata/tree.go @@ -23,7 +23,7 @@ import ( "bytes" "encoding/gob" - "github.com/intelsdi-x/pulse/pkg/ctree" + "github.com/intelsdi-x/snap/pkg/ctree" ) // Allows adding of config data by namespace and retrieving of data from tree diff --git a/core/cdata/tree_test.go b/core/cdata/tree_test.go index 496abe734..37f68140d 100644 --- a/core/cdata/tree_test.go +++ b/core/cdata/tree_test.go @@ -24,7 +24,7 @@ import ( "fmt" "testing" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) diff --git a/core/metric.go b/core/metric.go index ecb089fdc..dc5377844 100644 --- a/core/metric.go +++ b/core/metric.go @@ -23,8 +23,8 @@ import ( "strings" "time" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core/cdata" ) type Label struct { @@ -32,7 +32,7 @@ type Label struct { Name string `json:"name"` } -// Metric represents a Pulse metric collected or to be collected +// Metric represents a snap metric collected or to be collected type Metric interface { RequestedMetric Config() *cdata.ConfigDataNode diff --git a/core/perror/perror.go b/core/perror/perror.go index 38070971a..d85d5151f 100644 --- a/core/perror/perror.go +++ b/core/perror/perror.go @@ -19,7 +19,7 @@ limitations under the License. package perror -type PulseError interface { +type SnapError interface { error Fields() map[string]interface{} SetFields(map[string]interface{}) @@ -27,27 +27,27 @@ type PulseError interface { type Fields map[string]interface{} -type pulseError struct { +type snapError struct { err error fields Fields } -// New returns an initialized PulseError. +// New returns an initialized SnapError. // The variadic signature allows fields to optionally // be added at construction. -func New(e error, fields ...map[string]interface{}) *pulseError { +func New(e error, fields ...map[string]interface{}) *snapError { // Catch someone trying to wrap a pe around a pe. // We throw a panic to make them fix this. - if _, ok := e.(PulseError); ok { - panic("You are trying to wrap a pulseError around a PulseError. Don't do this.") + if _, ok := e.(SnapError); ok { + panic("You are trying to wrap a snapError around a SnapError. Don't do this.") } - p := &pulseError{ + p := &snapError{ err: e, fields: make(map[string]interface{}), } - // insert fields into new PulseError + // insert fields into new SnapError for _, f := range fields { for k, v := range f { p.fields[k] = v @@ -57,18 +57,18 @@ func New(e error, fields ...map[string]interface{}) *pulseError { return p } -func (p *pulseError) SetFields(f map[string]interface{}) { +func (p *snapError) SetFields(f map[string]interface{}) { p.fields = f } -func (p *pulseError) Fields() map[string]interface{} { +func (p *snapError) Fields() map[string]interface{} { return p.fields } -func (p *pulseError) Error() string { +func (p *snapError) Error() string { return p.err.Error() } -func (p *pulseError) String() string { +func (p *snapError) String() string { return p.Error() } diff --git a/core/plugin.go b/core/plugin.go index 6132834d2..a24277c9a 100644 --- a/core/plugin.go +++ b/core/plugin.go @@ -25,7 +25,7 @@ import ( "io/ioutil" "time" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/core/cdata" ) type Plugin interface { diff --git a/core/plugin_test.go b/core/plugin_test.go index 29f8724be..014310681 100644 --- a/core/plugin_test.go +++ b/core/plugin_test.go @@ -30,10 +30,10 @@ import ( ) var ( - PluginName = "pulse-collector-mock1" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) - SignatureFile = path.Join(PulsePath, "../pkg/psigning", "pulse-collector-mock1.asc") + PluginName = "snap-collector-mock1" + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) + SignatureFile = path.Join(SnapPath, "../pkg/psigning", "snap-collector-mock1.asc") ) func TestRequestedPlugin(t *testing.T) { diff --git a/core/scheduler_event/scheduler_event.go b/core/scheduler_event/scheduler_event.go index 47e8014db..3c478c166 100644 --- a/core/scheduler_event/scheduler_event.go +++ b/core/scheduler_event/scheduler_event.go @@ -20,7 +20,7 @@ limitations under the License. package scheduler_event import ( - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" ) const ( diff --git a/core/task.go b/core/task.go index 9abd0907a..d865e78f5 100644 --- a/core/task.go +++ b/core/task.go @@ -24,9 +24,9 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) type TaskState int @@ -140,5 +140,5 @@ func SetTaskID(id string) TaskOption { } type TaskErrors interface { - Errors() []perror.PulseError + Errors() []perror.SnapError } diff --git a/docs/PLUGIN_AUTHORING.md b/docs/PLUGIN_AUTHORING.md index 1086ba3b5..5f9ab4a44 100644 --- a/docs/PLUGIN_AUTHORING.md +++ b/docs/PLUGIN_AUTHORING.md @@ -18,37 +18,37 @@ limitations under the License. --> ## Plugin Authoring -Pulse itself runs as a master daemon with the core functionality that may load and unload plugin processes via either CLI or HTTP APIs. +snap itself runs as a master daemon with the core functionality that may load and unload plugin processes via either CLI or HTTP APIs. -A Pulse plugin is a program, or a set of functions or services, written in Go or any language; that may seamlessly integrate with Pulse as executables. +A snap plugin is a program, or a set of functions or services, written in Go or any language; that may seamlessly integrate with snap as executables. -Communication between Pulse and plugins uses RPC either through HTTP or TCP protocols. HTTP JSON-RPC is good for any language to use due to its nature of JSON representation of data while the native client is only suitable for plugins written in Golang. The data that plugins report to Pulse is in the form of JSON or GOB CODEC. +Communication between snap and plugins uses RPC either through HTTP or TCP protocols. HTTP JSON-RPC is good for any language to use due to its nature of JSON representation of data while the native client is only suitable for plugins written in Golang. The data that plugins report to snap is in the form of JSON or GOB CODEC. -Before starting writing Pulse plugins, check out the [Plugin Catalog](https://github.com/intelsdi-x/pulse/blob/master/docs/PLUGIN_CATALOG.md) to see if any suit your needs. If not, you need to reference the plugin packages that defines the type of structures and interfaces inside Pulse and then write plugin endpoints to implement the defined interfaces. +Before starting writing snap plugins, check out the [Plugin Catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) to see if any suit your needs. If not, you need to reference the plugin packages that defines the type of structures and interfaces inside snap and then write plugin endpoints to implement the defined interfaces. ## Getting started with the plugin development Before writing a plugin, you may sketch the type of metrics you want to collect or understand what kind of metrics you like to publish. Basic steps are: 1. Plan your plugin 2. Decide the CODEC for the plugin -3. Download or clone Pulse +3. Download or clone snap 4. Setup your development enviroment properly -5. Write the plugin that implements the type of interfaces defined in Pulse +5. Write the plugin that implements the type of interfaces defined in snap 6. Test the plugin 7. Expose the plugin ### Naming, Files, and Directory -Pulse supports three type of plugins. They are collectors, processors, and publishers. The plugin project name should use the following format: ->pulse-plugin-[type]-[name] +snap supports three type of plugins. They are collectors, processors, and publishers. The plugin project name should use the following format: +>snap-plugin-[type]-[name] For example: ->pulse-plugin-collector-hana ->pulse-plugin-processor-movingaverage ->pulse-plugin-publisher-influxdb +>snap-plugin-collector-hana +>snap-plugin-processor-movingaverage +>snap-plugin-publisher-influxdb Example files and directory structure: ``` -pulse-plugin-[type]-[name] +snap-plugin-[type]-[name] |--[name] |--[name].go |--[name]_test.go @@ -59,33 +59,33 @@ pulse-plugin-[type]-[name] ### Mandatory packages There are three mandatory packages that every plugin must use. Other than those three packages, you can use other packages as necessary. There is no danger of colliding dependencies as plugins are separated processes. The mandatory packages are: ``` -github.com/intelsdi-x/pulse/control/plugin -github.com/intelsdi-x/pulse/control/plugin/cpolicy -github.com/intelsdi-x/pulse/core/ctypes +github.com/intelsdi-x/snap/control/plugin +github.com/intelsdi-x/snap/control/plugin/cpolicy +github.com/intelsdi-x/snap/core/ctypes ``` ### Writing a collector plugin -A Pulse collector plugin collects telemetry data by communicating with the Pulse daemon. To confine to collector plugin interfaces and metric types defined in Pulse, a collector plugin must implement the following methods: +A snap collector plugin collects telemetry data by communicating with the snap daemon. To confine to collector plugin interfaces and metric types defined in snap, a collector plugin must implement the following methods: ``` GetConfigPolicy() (*cpolicy.ConfigPolicy, error) CollectMetrics([]PluginMetricType) ([]PluginMetricType, error) GetMetricTypes(PluginConfigType) ([]PluginMetricType, error) ``` ### Writing a processor plugin -A Pulse processor plugin allows filtering, aggregation, transformation, etc of collected telemetry data. To complaint with processor plugin interfaces defined in Pulse, a processor plugin must implement the following methods: +A snap processor plugin allows filtering, aggregation, transformation, etc of collected telemetry data. To complaint with processor plugin interfaces defined in snap, a processor plugin must implement the following methods: ``` GetConfigPolicy() (*cpolicy.ConfigPolicy, error) Process(contentType string, content []byte, config map[string]ctypes.ConfigValue) (string, []byte, error) ``` ### Writing a publisher plugin -A Pulse publisher plugin allows publishing processed telemetry data into a variety of systems, databases, and monitors through Pulse metrics. To compliant with metric types and plugin interfaces defined in Pulse, a publisher plugin must implement the following methods: +A snap publisher plugin allows publishing processed telemetry data into a variety of systems, databases, and monitors through snap metrics. To compliant with metric types and plugin interfaces defined in snap, a publisher plugin must implement the following methods: ``` GetConfigPolicy() (*cpolicy.ConfigPolicy, error) Publish(contentType string, content []byte, config map[string]ctypes.ConfigValue) error ``` ### Exposing a plugin -Creating the main program to serve the newly written plugin as an external process in main.go. By defining "Plugin.PluginMeta" with plugin specific settings, the newly created plugin may have its setting to override Pulse global settings. Please refer to [a sample](https://github.com/intelsdi-x/pulse/blob/master/plugin/collector/pulse-collector-mock1/main.go) to see how main.go is written. You may browse [Pulse global settings](https://github.com/intelsdi-x/pulse/blob/master/pulse.go#L45-L119). +Creating the main program to serve the newly written plugin as an external process in main.go. By defining "Plugin.PluginMeta" with plugin specific settings, the newly created plugin may have its setting to override snap global settings. Please refer to [a sample](https://github.com/intelsdi-x/snap/blob/master/plugin/collector/snap-collector-mock1/main.go) to see how main.go is written. You may browse [snap global settings](https://github.com/intelsdi-x/snap/blob/master/snap.go#L45-L119). -Building main.go generates a binary executable. You may choose to sign the executable with our [plugin signing](https://github.com/intelsdi-x/pulse/blob/master/pkg/psigning/README.md). +Building main.go generates a binary executable. You may choose to sign the executable with our [plugin signing](https://github.com/intelsdi-x/snap/blob/master/pkg/psigning/README.md). ### Localization All comments and READMEs within the plugin code should be in English. For different languages, include appropriate translation files within the plugin package for internationalization. @@ -93,14 +93,14 @@ All comments and READMEs within the plugin code should be in English. For diffe ### README All plugins should have a README with some standard fields: ``` - 1. Pulse version requires at least - 2. Pulse version tested up to + 1. snap version requires at least + 2. snap version tested up to 3. Supported platforms 4. Contributor 5. License ``` ### Encryption -Pulse provides the encryption capability for both HTTP and TCP clients. The communication between the Pulse Daemon and the plugins is encrypted by default. Should you want to disable the encrypted communication, when authoring a plugin, use the `Unsecure` option for your plugin's meta: +snap provides the encryption capability for both HTTP and TCP clients. The communication between the snap Daemon and the plugins is encrypted by default. Should you want to disable the encrypted communication, when authoring a plugin, use the `Unsecure` option for your plugin's meta: ``` //Meta returns the metadata for MyPlugin func Meta() *plugin.PluginMeta { @@ -109,23 +109,23 @@ func Meta() *plugin.PluginMeta { ``` ## Logging and debugging -Pulse uses [logrus](http://github.com/Sirupsen/logrus) to log. Your plugins can use it, or any standard Go log package. Each plugin has its log file. If no logging directory is specified, logs are in the /tmp directory of the running machine. INFO is the logging level for the release version of plugins. Loggers are excellent resources for debugging. You can also use Go GDB to debug. +snap uses [logrus](http://github.com/Sirupsen/logrus) to log. Your plugins can use it, or any standard Go log package. Each plugin has its log file. If no logging directory is specified, logs are in the /tmp directory of the running machine. INFO is the logging level for the release version of plugins. Loggers are excellent resources for debugging. You can also use Go GDB to debug. ## Building and running the tests -While developing a plugin, unit and integration tests need to be performed. Pulse uses [goconvery](http://github.com/smartystreets/goconvey/convey) for unit tests. You are welcome to use it or any other unit test framework. For the integration tests, you have to set up $PULSE_PATH and some necessary direct, or indirect dependencies. Using Docker container for integration tests is an effective testing strategy. Integration tests may define an input workflow. Refer to a sample [integration test input](https://github.com/intelsdi-x/pulse/blob/master/examples/configs/pulse-config-sample.json). +While developing a plugin, unit and integration tests need to be performed. snap uses [goconvery](http://github.com/smartystreets/goconvey/convey) for unit tests. You are welcome to use it or any other unit test framework. For the integration tests, you have to set up $SNAP_PATH and some necessary direct, or indirect dependencies. Using Docker container for integration tests is an effective testing strategy. Integration tests may define an input workflow. Refer to a sample [integration test input](https://github.com/intelsdi-x/snap/blob/master/examples/configs/snap-config-sample.json). For example, to run a plugin integration test ``` go test -v tag=integration ./… ``` -For more build and test tips, please refer to our [contributing doc](https://github.com/intelsdi-x/pulse/blob/master/CONTRIBUTING.md). +For more build and test tips, please refer to our [contributing doc](https://github.com/intelsdi-x/snap/blob/master/CONTRIBUTING.md). ## Distributing plugins -If you think others would find your plugin useful, we encourage you to submit it to our [Plugin Catalog](https://github.com/intelsdi-x/pulse/blob/master/docs/PLUGIN_CATALOG.md) for possible inclusion. +If you think others would find your plugin useful, we encourage you to submit it to our [Plugin Catalog](https://github.com/intelsdi-x/snap/blob/master/docs/PLUGIN_CATALOG.md) for possible inclusion. ## License -Project Pulse is released under the Apache 2.0 license. +Project snap is released under the Apache 2.0 license. ## For more help -Please browse more at our [repo](https://github.com/intelsdi-x/pulse) or contact Pulse [maintainers](https://github.com/intelsdi-x/pulse#maintainers). +Please browse more at our [repo](https://github.com/intelsdi-x/snap) or contact snap [maintainers](https://github.com/intelsdi-x/snap#maintainers). diff --git a/docs/PLUGIN_CATALOG.md b/docs/PLUGIN_CATALOG.md index 1193e0678..bfba5f953 100644 --- a/docs/PLUGIN_CATALOG.md +++ b/docs/PLUGIN_CATALOG.md @@ -1,4 +1,4 @@ -This is the master catalog of plugins for Pulse. The plugins in this list may be written by multiple sources. Please examine the license and documentation of each plugin for more information. +This is the master catalog of plugins for snap. The plugins in this list may be written by multiple sources. Please examine the license and documentation of each plugin for more information. ## Maintained plugins @@ -6,26 +6,26 @@ This is the master catalog of plugins for Pulse. The plugins in this list may be | Name | Type | Description | Link | | :---- | :---- | :---------- | :--- | -| CEPH | Collector | Collects from CEPH cluster | [pulse-plugin-collector-ceph](https://github.com/intelsdi-x/pulse-plugin-collector-ceph) -| Docker | Collector | Collects from Docker engine | [pulse-plugin-collector-docker](https://github.com/intelsdi-x/pulse-plugin-collector-docker) -| Facter | Collector | Collects from Facter | [pulse-plugin-collector-facter](https://github.com/intelsdi-x/pulse-plugin-collector-facter) | -| Libvirt | Collector | Collects from libvirt | [pulse-plugin-collector-libvirt](https://github.com/intelsdi-x/pulse-plugin-collector-libvirt) -| NodeManager | Collector | Collects from Intel Node Manager | [pulse-plugin-collector-node-manager](https://github.com/intelsdi-x/pulse-plugin-collector-node-manager) -| PCM | Collector | Collects from PCM.x | [pulse-plugin-collector-pcm](https://github.com/intelsdi-x/pulse-plugin-collector-pcm)| -| Perfevents | Collector | Collects perfevents from Linux | [pulse-plugin-collector-perfevents](https://github.com/intelsdi-x/pulse-plugin-collector-perfevents)| -| PSUtil | Collector | Collects from psutil | [pulse-plugin-collector-psutil](https://github.com/intelsdi-x/pulse-plugin-collector-psutil) | -| SMART | Collector | Collects SMART metrics from Intel SSDs | [pulse-plugin-collector-smart](https://github.com/intelsdi-x/pulse-plugin-collector-smart) | +| CEPH | Collector | Collects from CEPH cluster | [snap-plugin-collector-ceph](https://github.com/intelsdi-x/snap-plugin-collector-ceph) +| Docker | Collector | Collects from Docker engine | [snap-plugin-collector-docker](https://github.com/intelsdi-x/snap-plugin-collector-docker) +| Facter | Collector | Collects from Facter | [snap-plugin-collector-facter](https://github.com/intelsdi-x/snap-plugin-collector-facter) | +| Libvirt | Collector | Collects from libvirt | [snap-plugin-collector-libvirt](https://github.com/intelsdi-x/snap-plugin-collector-libvirt) +| NodeManager | Collector | Collects from Intel Node Manager | [snap-plugin-collector-node-manager](https://github.com/intelsdi-x/snap-plugin-collector-node-manager) +| PCM | Collector | Collects from PCM.x | [snap-plugin-collector-pcm](https://github.com/intelsdi-x/snap-plugin-collector-pcm)| +| Perfevents | Collector | Collects perfevents from Linux | [snap-plugin-collector-perfevents](https://github.com/intelsdi-x/snap-plugin-collector-perfevents)| +| PSUtil | Collector | Collects from psutil | [snap-plugin-collector-psutil](https://github.com/intelsdi-x/snap-plugin-collector-psutil) | +| SMART | Collector | Collects SMART metrics from Intel SSDs | [snap-plugin-collector-smart](https://github.com/intelsdi-x/snap-plugin-collector-smart) | | -| Movingaverage | Processor | Processes data and outputs movingaverage | [pulse-plugin-processor-movingaverage](https://github.com/intelsdi-x/pulse-plugin-processor-movingaverage) | +| Movingaverage | Processor | Processes data and outputs movingaverage | [snap-plugin-processor-movingaverage](https://github.com/intelsdi-x/snap-plugin-processor-movingaverage) | | -| HANA | Publisher | Writes to SAP HANA Database | [pulse-plugin-publisher-hana](https://github.com/intelsdi-x/pulse-plugin-publisher-hana) | -| InfluxDB | Publisher | Writes to Influx Database | [pulse-plugin-publisher-influxdb](https://github.com/intelsdi-x/pulse-plugin-publisher-influxdb) | -| Kafka | Publisher | Writs to Kafka messaging system | [pulse-plugin-publisher-kafka](https://github.com/intelsdi-x/pulse-plugin-publisher-kafka) | -| MySQL | Publisher | Writes to MySQL Database | [pulse-plugin-publisher-mysql](https://github.com/intelsdi-x/pulse-plugin-publisher-mysql) | -| OpenTSDB | Publisher | Writes to Opentsdb Database | [pulse-plugin-publisher-opentsdb](https://github.com/intelsdi-x/pulse-plugin-publisher-opentsdb) | -| PostgreSQL | Publisher | Writes to PostgreSQL Database | [pulse-plugin-publisher-postgresql](https://github.com/intelsdi-x/pulse-plugin-publisher-postgresql) | -| RabbitMQ | Publisher | Writes to RabbitMQ | [pulse-plugin-publisher-rabbitmq](https://github.com/intelsdi-x/pulse-plugin-publisher-rabbitmq) | -| Riemann | Publisher | Writes to Riemann monitoring system | [pulse-plugin-publisher-riemann](https://github.com/intelsdi-x/pulse-plugin-publisher-riemann) | +| HANA | Publisher | Writes to SAP HANA Database | [snap-plugin-publisher-hana](https://github.com/intelsdi-x/snap-plugin-publisher-hana) | +| InfluxDB | Publisher | Writes to Influx Database | [snap-plugin-publisher-influxdb](https://github.com/intelsdi-x/snap-plugin-publisher-influxdb) | +| Kafka | Publisher | Writs to Kafka messaging system | [snap-plugin-publisher-kafka](https://github.com/intelsdi-x/snap-plugin-publisher-kafka) | +| MySQL | Publisher | Writes to MySQL Database | [snap-plugin-publisher-mysql](https://github.com/intelsdi-x/snap-plugin-publisher-mysql) | +| OpenTSDB | Publisher | Writes to Opentsdb Database | [snap-plugin-publisher-opentsdb](https://github.com/intelsdi-x/snap-plugin-publisher-opentsdb) | +| PostgreSQL | Publisher | Writes to PostgreSQL Database | [snap-plugin-publisher-postgresql](https://github.com/intelsdi-x/snap-plugin-publisher-postgresql) | +| RabbitMQ | Publisher | Writes to RabbitMQ | [snap-plugin-publisher-rabbitmq](https://github.com/intelsdi-x/snap-plugin-publisher-rabbitmq) | +| Riemann | Publisher | Writes to Riemann monitoring system | [snap-plugin-publisher-riemann](https://github.com/intelsdi-x/snap-plugin-publisher-riemann) | ### Third-party @@ -36,19 +36,19 @@ These plugins are in planned/active development. This list is useful if you want | Name | Type | Description | Link | Authors | | :---- | :---- | :---------- | :--- | :------ | -| Ethtool | Collector | Collect from ethtool stats & registry dump |[pulse-plugin-collector-ethtool](https://github.com/intelsdi-x/pulse-plugin-collector-ethtool)| [@lmroz](https://github.com/lmroz)| -| IOstat | Collector | Collect from IOstat | [pulse-plugin-collector-iostat](https://github.com/intelsdi-x/pulse-plugin-collector-iostat) | [@IzabellaRaulin](https://github.com/IzabellaRaulin) | +| Ethtool | Collector | Collect from ethtool stats & registry dump |[snap-plugin-collector-ethtool](https://github.com/intelsdi-x/snap-plugin-collector-ethtool)| [@lmroz](https://github.com/lmroz)| +| IOstat | Collector | Collect from IOstat | [snap-plugin-collector-iostat](https://github.com/intelsdi-x/snap-plugin-collector-iostat) | [@IzabellaRaulin](https://github.com/IzabellaRaulin) | | Nova | Collector | Collect from Nova/Libvirt | -| [@sandlbn](https://github.com/sandlbn) | | Open vSwitch | Collector | Collect Open vSwitch performance data | -| [@sandlbn](https://github.com/sandlbn) | -| OSv | Collector | Collect from OSv | [pulse-plugin-collector-osv](https://github.com/intelsdi-x/pulse-plugin-collector-osv) | [@sandlbn](https://github.com/sandlbn) | +| OSv | Collector | Collect from OSv | [snap-plugin-collector-osv](https://github.com/intelsdi-x/snap-plugin-collector-osv) | [@sandlbn](https://github.com/sandlbn) | ## Wish List -This is a wish list of plugins for Pulse. If you see one here and want to start on it please let us know. +This is a wish list of plugins for snap. If you see one here and want to start on it please let us know. #### Collector - CollectD native - Prometheus -- Pulse App Endpoint (needs event spec) +- snap App Endpoint (needs event spec) - Intel NIC - Kubernetes Minion - Mesos Slave diff --git a/docs/RESTAPI.md b/docs/RESTAPI.md index 5af9d3498..9ef16cc5d 100644 --- a/docs/RESTAPI.md +++ b/docs/RESTAPI.md @@ -1,5 +1,5 @@ -# Pulse API -Pulse exposes a list of Restful APIs to perform various actions. All of Pulse APIs return `JSON` as the reponses, including errors. Any non-2xx HTTP status code may contain an error message. All API URLs listed in this documentation has the endpoint: +# snap API +snap exposes a list of Restful APIs to perform various actions. All of snap APIs return `JSON` as the reponses, including errors. Any non-2xx HTTP status code may contain an error message. All API URLs listed in this documentation has the endpoint: > http://localhost:8181 ## API Response Meta @@ -123,7 +123,7 @@ Load a plugin _**Example Request**_ ``` -curl -X POST -F plugin=@build/plugin/pulse-collector-mock1 http://localhost:8181/v1/plugins +curl -X POST -F plugin=@build/plugin/snap-collector-mock1 http://localhost:8181/v1/plugins ``` _**Example Response**_ ``` @@ -191,7 +191,7 @@ _**Example Response**_ } ``` ## Metric API -Pulse metric APIs allow you to retrieve all or particular running metric information by invoking different APIs. +snap metric APIs allow you to retrieve all or particular running metric information by invoking different APIs. ## Metric Response Parameters | Parameter | Description | @@ -306,7 +306,7 @@ _**Example Response**_ } ``` ## Task API -Pulse task APIs provide the functionality to create, start, stop, remove, enable, retrieve and watch scheduled tasks. +snap task APIs provide the functionality to create, start, stop, remove, enable, retrieve and watch scheduled tasks. ### Task API Response Parameters | Parameter | Description | @@ -587,7 +587,7 @@ _**Example Response**_ } ``` ## Tribe API -Pulse tribe APIs provide the functionality for managing tribe agreements and for tribe members to join or leave tribe contracts. +snap tribe APIs provide the functionality for managing tribe agreements and for tribe members to join or leave tribe contracts. ### Tribe API Response Parameters | Parameter | Description | diff --git a/docs/PULSED.md b/docs/SNAPD.MD similarity index 75% rename from docs/PULSED.md rename to docs/SNAPD.MD index 0216a67fa..7658cf5d9 100644 --- a/docs/PULSED.md +++ b/docs/SNAPD.MD @@ -17,11 +17,11 @@ See the License for the specific language governing permissions and limitations under the License. --> -# pulsed +# snapd ## Usage ``` -$PULSE_PATH/bin/pulsed [global options] [arguments...] +$SNAP_PATH/bin/snapd [global options] [arguments...] ``` ### Options @@ -29,25 +29,25 @@ $PULSE_PATH/bin/pulsed [global options] [arguments...] --auto-discover, -a Autodiscover paths separated by colons. --log-level, -l 1-5 (Debug, Info, Warning, Error, Fatal) --log-path, -o Path for logs. (Default: Logs to stdout) ---max-procs, -c Set max cores to use for Pulse Agent. (Default: 1 core) +--max-procs, -c Set max cores to use for snap Agent. (Default: 1 core) --api-port, -p Port rest api will listen on. (Default: 8181) --disable-api, -d Flag to enable/disable rest api. (Default: true) ---version, -v Print Pulse version. +--version, -v Print snap version. ``` ## Example Usage ``` -$PULSE_PATH/bin/pulsed -$PULSE_PATH/bin/pulsed --log-level 1 -$PULSE_PATH/bin/pulsed --version +$SNAP_PATH/bin/snapd +$SNAP_PATH/bin/snapd --log-level 1 +$SNAP_PATH/bin/snapd --version ``` ## Example Output ``` -INFO[0000] Starting pulsed (version: alpha) +INFO[0000] Starting snapd (version: alpha) INFO[0000] started _block=start _module=control -INFO[0000] module started _module=pulsed block=main pulse-module=control +INFO[0000] module started _module=snapd block=main snap-module=control INFO[0000] scheduler started _block=start-scheduler _module=scheduler -INFO[0000] module started _module=pulsed block=main pulse-module=scheduler -INFO[0000] [pulse-rest] listening on :8181 +INFO[0000] module started _module=snapd block=main snap-module=scheduler +INFO[0000] [snap-rest] listening on :8181 ``` diff --git a/examples/README.md b/examples/README.md index eeffe2f8a..5aa715cef 100644 --- a/examples/README.md +++ b/examples/README.md @@ -17,9 +17,9 @@ See the License for the specific language governing permissions and limitations under the License. --> -# Pulse Examples +# snap Examples -This folder contains examples of using Pulse. Each folder contains a README.md which explains the examples. +This folder contains examples of using snap. Each folder contains a README.md which explains the examples. ### Example list diff --git a/examples/configs/pulse-config-sample.json b/examples/configs/snap-config-sample.json similarity index 100% rename from examples/configs/pulse-config-sample.json rename to examples/configs/snap-config-sample.json diff --git a/examples/influxdb-grafana/README.md b/examples/influxdb-grafana/README.md index 8cab90c96..591fa58e9 100644 --- a/examples/influxdb-grafana/README.md +++ b/examples/influxdb-grafana/README.md @@ -30,10 +30,10 @@ These examples all include configuring and starting influxdb (a time series data The following scripts can be used to start the demos - run-pcm.sh *\* - - starts pulsed + - starts snapd - creates and starts a task that collects from both the pcm and psutil plugins - run-psutil.sh *\* - - starts pulsed + - starts snapd - creates and starts a task that collects from psutil plugin - ./run.sh *\* - configured influxdb and grafana only diff --git a/examples/influxdb-grafana/grafana/pcm-psutil.json b/examples/influxdb-grafana/grafana/pcm-psutil.json index 6fcfbf7e9..7e3306cf2 100644 --- a/examples/influxdb-grafana/grafana/pcm-psutil.json +++ b/examples/influxdb-grafana/grafana/pcm-psutil.json @@ -3,8 +3,8 @@ "dashboard": { "id": null, - "title": "Pulse Dashboard", - "originalTitle": "Pulse Dashboard", + "title": "snap Dashboard", + "originalTitle": "snap Dashboard", "tags": [], "style": "dark", "timezone": "browser", diff --git a/examples/influxdb-grafana/grafana/psutil.json b/examples/influxdb-grafana/grafana/psutil.json index 47021cc1d..6b6a973d1 100644 --- a/examples/influxdb-grafana/grafana/psutil.json +++ b/examples/influxdb-grafana/grafana/psutil.json @@ -2,8 +2,8 @@ "overwrite": true, "dashboard": { "id": null, - "title": "Pulse Dashboard", - "originalTitle": "Pulse Dashboard", + "title": "snap Dashboard", + "originalTitle": "snap Dashboard", "tags": [], "style": "dark", "timezone": "browser", diff --git a/examples/influxdb-grafana/run-psutil.sh b/examples/influxdb-grafana/run-psutil.sh index 227dc29d7..55b153bdd 100755 --- a/examples/influxdb-grafana/run-psutil.sh +++ b/examples/influxdb-grafana/run-psutil.sh @@ -23,13 +23,13 @@ die () { } [ "$#" -eq 1 ] || die "Error: Expected to get one or more machine names as arguments." -[ "${PULSE_PATH}x" != "x" ] || die "Error: PULSE_PATH must be set" +[ "${SNAP_PATH}x" != "x" ] || die "Error: SNAP_PATH must be set" command -v docker-machine >/dev/null 2>&1 || die "Error: docker-machine is required." command -v docker-compose >/dev/null 2>&1 || die "Error: docker-compose is required." command -v docker >/dev/null 2>&1 || die "Error: docker is required." command -v netcat >/dev/null 2>&1 || die "Error: netcat is required." -file $PULSE_PATH/plugin/pulse-plugin-collector-psutil >/dev/null 2>&1 || die "Error: missing $PULSE_PATH/build/plugin/pulse-plugin-collector-psutil" -file $PULSE_PATH/plugin/pulse-plugin-publisher-influxdb >/dev/null 2>&1 || die "Error: missing $PULSE_PATH/build/plugin/pulse-plugin-publisher-influxdb" +file $SNAP_PATH/plugin/snap-plugin-collector-psutil >/dev/null 2>&1 || die "Error: missing $SNAP_PATH/build/plugin/snap-plugin-collector-psutil" +file $SNAP_PATH/plugin/snap-plugin-publisher-influxdb >/dev/null 2>&1 || die "Error: missing $SNAP_PATH/build/plugin/snap-plugin-publisher-influxdb" @@ -53,18 +53,18 @@ echo "" influx_ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' influxdbgrafana_influxdb_1) echo "influxdb ip: ${influx_ip}" -# create pulse database in influxdb +# create snap database in influxdb curl -G "http://${dm_ip}:8086/ping" -echo -n ">>deleting pulse influx db (if it exists) => " -curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=DROP DATABASE pulse" +echo -n ">>deleting snap influx db (if it exists) => " +curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=DROP DATABASE snap" echo "" -echo -n "creating pulse influx db => " -curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=CREATE DATABASE pulse" +echo -n "creating snap influx db => " +curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=CREATE DATABASE snap" echo "" # create influxdb datasource in grafana echo -n "adding influxdb datasource to grafana => " -COOKIEJAR=$(mktemp -t 'pulse-tmp') +COOKIEJAR=$(mktemp -t 'snap-tmp') curl -H 'Content-Type: application/json;charset=UTF-8' \ --data-binary '{"user":"admin","email":"","password":"admin"}' \ --cookie-jar "$COOKIEJAR" \ @@ -74,11 +74,11 @@ curl --cookie "$COOKIEJAR" \ -X POST \ --silent \ -H 'Content-Type: application/json;charset=UTF-8' \ - --data-binary "{\"name\":\"influx\",\"type\":\"influxdb\",\"url\":\"http://${influx_ip}:8086\",\"access\":\"proxy\",\"database\":\"pulse\",\"user\":\"admin\",\"password\":\"admin\"}" \ + --data-binary "{\"name\":\"influx\",\"type\":\"influxdb\",\"url\":\"http://${influx_ip}:8086\",\"access\":\"proxy\",\"database\":\"snap\",\"user\":\"admin\",\"password\":\"admin\"}" \ "http://${dm_ip}:3000/api/datasources" echo "" -dashboard=$(cat $PULSE_PATH/../examples/influxdb-grafana/grafana/psutil.json) +dashboard=$(cat $SNAP_PATH/../examples/influxdb-grafana/grafana/psutil.json) curl --cookie "$COOKIEJAR" \ -X POST \ --silent \ @@ -87,22 +87,22 @@ curl --cookie "$COOKIEJAR" \ "http://${dm_ip}:3000/api/dashboards/db" echo "" -echo -n "starting pulsed" -$PULSE_PATH/bin/pulsed --log-level 1 -t 0 --auto-discover $PULSE_PATH/plugin > /tmp/pulse.out 2>&1 & +echo -n "starting snapd" +$SNAP_PATH/bin/snapd --log-level 1 -t 0 --auto-discover $SNAP_PATH/plugin > /tmp/snap.out 2>&1 & echo "" sleep 3 echo -n "adding task " -TASK="${TMPDIR}/pulse-task-$$.json" +TASK="${TMPDIR}/snap-task-$$.json" echo "$TASK" -cat $PULSE_PATH/../examples/tasks/psutil-influx.json | sed s/INFLUXDB_IP/${dm_ip}/ > $TASK -$PULSE_PATH/bin/pulsectl task create -t $TASK +cat $SNAP_PATH/../examples/tasks/psutil-influx.json | sed s/INFLUXDB_IP/${dm_ip}/ > $TASK +$SNAP_PATH/bin/snapctl task create -t $TASK echo "" -echo "Grafana Dashboard => http://${dm_ip}:3000/dashboard/db/pulse-dashboard" +echo "Grafana Dashboard => http://${dm_ip}:3000/dashboard/db/snap-dashboard" echo "Influxdb UI => http://${dm_ip}:8083" echo "" -echo "Press enter to start viewing the pulse.log" +echo "Press enter to start viewing the snap.log" read -tail -f /tmp/pulse.out +tail -f /tmp/snap.out diff --git a/examples/influxdb-grafana/run.sh b/examples/influxdb-grafana/run.sh index 08452d596..0a3cc0b49 100755 --- a/examples/influxdb-grafana/run.sh +++ b/examples/influxdb-grafana/run.sh @@ -23,7 +23,7 @@ die () { } [ "$#" -eq 1 ] || die "Error: Expected to get one or more machine names as arguments." -[ "${PULSE_PATH}x" != "x" ] || die "Error: PULSE_PATH must be set" +[ "${SNAP_PATH}x" != "x" ] || die "Error: SNAP_PATH must be set" command -v docker-machine >/dev/null 2>&1 || die "Error: docker-machine is required." command -v docker-compose >/dev/null 2>&1 || die "Error: docker-compose is required." command -v docker >/dev/null 2>&1 || die "Error: docker is required." @@ -50,19 +50,19 @@ echo "" influx_ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' influxdbgrafana_influxdb_1) echo ">>influxdb ip: ${influx_ip}" -# create pulse database in influxdb +# create snap database in influxdb curl -G "http://${dm_ip}:8086/ping" -echo -n ">>deleting pulse influx db (if it exists) => " -curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=DROP DATABASE pulse" +echo -n ">>deleting snap influx db (if it exists) => " +curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=DROP DATABASE snap" echo "" -echo -n ">>creating pulse influx db => " +echo -n ">>creating snap influx db => " sleep 1 -curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=CREATE DATABASE pulse" +curl -G "http://${dm_ip}:8086/query?u=admin&p=admin" --data-urlencode "q=CREATE DATABASE snap" echo "" # create influxdb datasource in grafana echo -n ">>adding influxdb datasource to grafana => " -COOKIEJAR=$(mktemp -t 'pulse-tmp') +COOKIEJAR=$(mktemp -t 'snap-tmp') curl -H 'Content-Type: application/json;charset=UTF-8' \ --data-binary '{"user":"admin","email":"","password":"admin"}' \ --cookie-jar "$COOKIEJAR" \ @@ -72,11 +72,11 @@ curl --cookie "$COOKIEJAR" \ -X POST \ --silent \ -H 'Content-Type: application/json;charset=UTF-8' \ - --data-binary "{\"name\":\"influx\",\"type\":\"influxdb\",\"url\":\"http://${influx_ip}:8086\",\"access\":\"proxy\",\"database\":\"pulse\",\"user\":\"admin\",\"password\":\"admin\"}" \ + --data-binary "{\"name\":\"influx\",\"type\":\"influxdb\",\"url\":\"http://${influx_ip}:8086\",\"access\":\"proxy\",\"database\":\"snap\",\"user\":\"admin\",\"password\":\"admin\"}" \ "http://${dm_ip}:3000/api/datasources" echo "" -dashboard=$(cat $PULSE_PATH/../examples/influxdb-grafana/grafana/pcm-psutil.json) +dashboard=$(cat $SNAP_PATH/../examples/influxdb-grafana/grafana/pcm-psutil.json) curl --cookie "$COOKIEJAR" \ -X POST \ --silent \ diff --git a/examples/linux_prep.sh b/examples/linux_prep.sh index 174548a22..8e89255c1 100755 --- a/examples/linux_prep.sh +++ b/examples/linux_prep.sh @@ -18,9 +18,9 @@ #limitations under the License. HOST_PUBLIC_KEY_FILE="/root/.ssh/id_rsa.pub" -DOCKER_IMAGE_NAME="pulse_image_ssh_container" -DOCKER_CONTAINER_NAME="pulse_ssh_container" -DOCKER_MACHINE_NAME="pulsecontainer" +DOCKER_IMAGE_NAME="snap_image_ssh_container" +DOCKER_CONTAINER_NAME="snap_ssh_container" +DOCKER_MACHINE_NAME="snapcontainer" # Copy host's public key file here. It will be used as authorized_key in docker container (see Dockerfile). if [[ -f $HOST_PUBLIC_KEY_FILE ]] diff --git a/examples/riemann/Vagrantfile b/examples/riemann/Vagrantfile index 7a11cc9db..518e4df7d 100644 --- a/examples/riemann/Vagrantfile +++ b/examples/riemann/Vagrantfile @@ -37,5 +37,5 @@ Vagrant.configure("2") do |config| v.vmx["numvcpus"] = "2" end - config.vm.synced_folder "../../", "/vagrant/go/src/github.com/intelsdi-x/pulse" + config.vm.synced_folder "../../", "/vagrant/go/src/github.com/intelsdi-x/snap" end \ No newline at end of file diff --git a/examples/riemann/script/init.sh b/examples/riemann/script/init.sh index 1469ece8e..52a0c15a6 100755 --- a/examples/riemann/script/init.sh +++ b/examples/riemann/script/init.sh @@ -49,9 +49,9 @@ export GOBIN=/vagrant/go/bin export PATH=$PATH:$GOBIN go get github.com/tools/godep -cd $GOPATH/src/github.com/intelsdi-x/pulse +cd $GOPATH/src/github.com/intelsdi-x/snap scripts/deps.sh make -echo "PATH=$PATH:$GOPATH/src/github.com/intelsdi-x/pulse/build/bin" >> /home/vagrant/.bash_profile -export PATH=$PATH:$GOPATH/src/github.com/intelsdi-x/pulse/build/bin +echo "PATH=$PATH:$GOPATH/src/github.com/intelsdi-x/snap/build/bin" >> /home/vagrant/.bash_profile +export PATH=$PATH:$GOPATH/src/github.com/intelsdi-x/snap/build/bin diff --git a/examples/tasks/psutil-influx.json b/examples/tasks/psutil-influx.json index fc912a6b4..c907f6be3 100644 --- a/examples/tasks/psutil-influx.json +++ b/examples/tasks/psutil-influx.json @@ -30,7 +30,7 @@ "config": { "host": "INFLUXDB_IP", "port": 8086, - "database": "pulse", + "database": "snap", "user": "admin", "password": "admin" } diff --git a/examples/videos.md b/examples/videos.md index f19de1e7a..0db14cc05 100644 --- a/examples/videos.md +++ b/examples/videos.md @@ -15,27 +15,27 @@ #See the License for the specific language governing permissions and #limitations under the License. -# Pulse videos +# snap videos #### Intel PCM (Performance Counter Metrics) published to Influxdb This video demonstrates -- starting pulsed +- starting snapd - auto-discovering plugins - creating and starting a task - watching a task from the CLI - viewing the results in a dashboard -[Watch it!](https://objectstorage-us-nw-in.icloud.intel.com/v1/AUTH_365110c0a02242919e50ffb4dc241543/pulse/pcm-watch.mp4) +[Watch it!](https://objectstorage-us-nw-in.icloud.intel.com/v1/AUTH_365110c0a02242919e50ffb4dc241543/snap/pcm-watch.mp4) length: 00:02:30 This video demonstrates through a fully automated script - + starting pulse + + starting snap + auto discovering plugins + creating and starting a task * The task collects data from PCM and PSUTIL * The task publishes collected metrics to influxdb on a 1 second interval + viewing the results in grafana -[Watch it!](https://objectstorage-us-nw-in.icloud.intel.com/v1/AUTH_365110c0a02242919e50ffb4dc241543/pulse/pulse-pcm-grafana-influxdb.mp4) +[Watch it!](https://objectstorage-us-nw-in.icloud.intel.com/v1/AUTH_365110c0a02242919e50ffb4dc241543/snap/snap-pcm-grafana-influxdb.mp4) length: 00:00:45 diff --git a/mgmt/rest/Godeps/Godeps.json b/mgmt/rest/Godeps/Godeps.json index 329fa86bc..0698fa0ec 100644 --- a/mgmt/rest/Godeps/Godeps.json +++ b/mgmt/rest/Godeps/Godeps.json @@ -1,5 +1,5 @@ { - "ImportPath": "github.com/intelsdi-x/pulse/mgmt/rest", + "ImportPath": "github.com/intelsdi-x/snap/mgmt/rest", "GoVersion": "go1.4.2", "Deps": [ { diff --git a/mgmt/rest/client/README.md b/mgmt/rest/client/README.md index 5c7b0790c..6494b1d62 100644 --- a/mgmt/rest/client/README.md +++ b/mgmt/rest/client/README.md @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -Go Pulse Client +Go snap Client =============== -Go bindings for Pulse's REST API +Go bindings for snap's REST API diff --git a/mgmt/rest/client/client.go b/mgmt/rest/client/client.go index 094d9f235..aedc78432 100644 --- a/mgmt/rest/client/client.go +++ b/mgmt/rest/client/client.go @@ -35,7 +35,7 @@ import ( "path/filepath" "strings" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) var ( @@ -72,7 +72,7 @@ type Client struct { prefix string } -// New returns a pointer to a pulse api client +// New returns a pointer to a snap api client // if ver is an empty string, v1 is used by default func New(url, ver string, insecure bool) *Client { if ver == "" { @@ -101,7 +101,7 @@ func (t contentType) String() string { } /* - do handles all interactions with Pulse's REST API. + do handles all interactions with snap's REST API. we use the variadic function signature so that all actions can use the same function, including ones which do not include a request body. */ @@ -251,7 +251,7 @@ func (c *Client) pluginUploadRequest(pluginPaths []string) (*rbody.APIResponse, func writePluginToWriter(pw io.WriteCloser, bufin []*bufio.Reader, writer *multipart.Writer, pluginPaths []string, errChan chan error) { for i, pluginPath := range pluginPaths { - part, err := writer.CreateFormFile("pulse-plugins", pluginPath) + part, err := writer.CreateFormFile("snap-plugins", pluginPath) if err != nil { errChan <- err return diff --git a/mgmt/rest/client/client_config_func_test.go b/mgmt/rest/client/client_config_func_test.go index 5df110aab..898e226a0 100644 --- a/mgmt/rest/client/client_config_func_test.go +++ b/mgmt/rest/client/client_config_func_test.go @@ -24,11 +24,11 @@ import ( . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/ctypes" ) -func TestPulseClientConfig(t *testing.T) { +func TestSnapClientConfig(t *testing.T) { uri := startAPI() CompressUpload = false c := New(uri, "v1", true) diff --git a/mgmt/rest/client/client_func_test.go b/mgmt/rest/client/client_func_test.go index f2d9f18c5..57b112496 100644 --- a/mgmt/rest/client/client_func_test.go +++ b/mgmt/rest/client/client_func_test.go @@ -32,10 +32,10 @@ import ( log "github.com/Sirupsen/logrus" "github.com/pborman/uuid" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/mgmt/rest" - "github.com/intelsdi-x/pulse/scheduler" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/mgmt/rest" + "github.com/intelsdi-x/snap/scheduler" + "github.com/intelsdi-x/snap/scheduler/wmap" . "github.com/smartystreets/goconvey/convey" ) @@ -43,11 +43,11 @@ var ( // Change to set the REST API logging to debug LOG_LEVEL = log.FatalLevel - PULSE_PATH = os.Getenv("PULSE_PATH") - MOCK_PLUGIN_PATH1 = []string{PULSE_PATH + "/plugin/pulse-collector-mock1"} - MOCK_PLUGIN_PATH2 = []string{PULSE_PATH + "/plugin/pulse-collector-mock2"} - FILE_PLUGIN_PATH = []string{PULSE_PATH + "/plugin/pulse-publisher-file"} - DIRECTORY_PATH = []string{PULSE_PATH + "/plugin/"} + SNAP_PATH = os.Getenv("SNAP_PATH") + MOCK_PLUGIN_PATH1 = []string{SNAP_PATH + "/plugin/snap-collector-mock1"} + MOCK_PLUGIN_PATH2 = []string{SNAP_PATH + "/plugin/snap-collector-mock2"} + FILE_PLUGIN_PATH = []string{SNAP_PATH + "/plugin/snap-publisher-file"} + DIRECTORY_PATH = []string{SNAP_PATH + "/plugin/"} NextPort = 45000 ) @@ -88,7 +88,7 @@ func startAPI() string { return fmt.Sprintf("http://localhost:%d", r.Port()) } -func TestPulseClient(t *testing.T) { +func TestSnapClient(t *testing.T) { CompressUpload = false uri := startAPI() diff --git a/mgmt/rest/client/client_tribe_func_test.go b/mgmt/rest/client/client_tribe_func_test.go index b5c28b0d1..679e25d5b 100644 --- a/mgmt/rest/client/client_tribe_func_test.go +++ b/mgmt/rest/client/client_tribe_func_test.go @@ -33,12 +33,12 @@ import ( log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/mgmt/rest" - "github.com/intelsdi-x/pulse/mgmt/rest/client" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/tribe" - "github.com/intelsdi-x/pulse/scheduler" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/mgmt/rest" + "github.com/intelsdi-x/snap/mgmt/rest/client" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/tribe" + "github.com/intelsdi-x/snap/scheduler" ) func getPort() int { @@ -89,7 +89,7 @@ func getMembers(port int) *rbody.APIResponse { return getAPIResponse(resp) } -func TestPulseClientTribe(t *testing.T) { +func TestSnapClientTribe(t *testing.T) { Convey("REST API functional V1 - TRIBE", t, func() { numOfTribes := 4 ports := startTribes(numOfTribes) diff --git a/mgmt/rest/client/config.go b/mgmt/rest/client/config.go index 030896aa0..1eea17a2b 100644 --- a/mgmt/rest/client/config.go +++ b/mgmt/rest/client/config.go @@ -24,8 +24,8 @@ import ( "fmt" "net/url" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) // GetPluginConfig retrieves the merged plugin config given the type of plugin, @@ -112,19 +112,19 @@ func (c *Client) DeletePluginConfig(pluginType, name, version string, key string return r } -// GetPluginConfigResult is the response from pulse/client on a GetPluginConfig call. +// GetPluginConfigResult is the response from snap/client on a GetPluginConfig call. type GetPluginConfigResult struct { *rbody.PluginConfigItem Err error } -// SetPluginConfigResult is the response from pulse/client on a SetPluginConfig call. +// SetPluginConfigResult is the response from snap/client on a SetPluginConfig call. type SetPluginConfigResult struct { *rbody.SetPluginConfigItem Err error } -// DeletePluginConfigResult is the response from pulse/client on a DeletePluginConfig call. +// DeletePluginConfigResult is the response from snap/client on a DeletePluginConfig call. type DeletePluginConfigResult struct { *rbody.DeletePluginConfigItem Err error diff --git a/mgmt/rest/client/metric.go b/mgmt/rest/client/metric.go index 8bd8f896f..9b642c6ee 100644 --- a/mgmt/rest/client/metric.go +++ b/mgmt/rest/client/metric.go @@ -23,7 +23,7 @@ import ( "errors" "fmt" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) var ( @@ -31,7 +31,7 @@ var ( ErrAPIResponseMetaType = errors.New("Received an invalid API response (META/TYPE)") ) -// GetMetricCatalog retrieves the metric catalog from a pulse/client by issuing an HTTP GET request. +// GetMetricCatalog retrieves the metric catalog from a snap/client by issuing an HTTP GET request. // A slice of metric catalogs returns if succeeded. Otherwise an error is returned. func (c *Client) GetMetricCatalog() *GetMetricsResult { r := &GetMetricsResult{} @@ -77,7 +77,7 @@ func (c *Client) FetchMetrics(ns string, ver int) *GetMetricsResult { return r } -// GetMetricsResult is the response from pulse/client on a GetMetricCatalog call. +// GetMetricsResult is the response from snap/client on a GetMetricCatalog call. type GetMetricsResult struct { Catalog []*rbody.Metric Err error diff --git a/mgmt/rest/client/plugin.go b/mgmt/rest/client/plugin.go index 8c5468c51..6b598151a 100644 --- a/mgmt/rest/client/plugin.go +++ b/mgmt/rest/client/plugin.go @@ -24,8 +24,8 @@ import ( "net/url" "time" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) // LoadPlugin loads plugins for the given plugin names. @@ -112,20 +112,20 @@ func (c *Client) GetPlugins(details bool) *GetPluginsResult { return r } -// GetPluginsResult is the response from pulse/client on a GetPlugins call. +// GetPluginsResult is the response from snap/client on a GetPlugins call. type GetPluginsResult struct { LoadedPlugins []LoadedPlugin AvailablePlugins []AvailablePlugin Err error } -// LoadPluginResult is the response from pulse/client on a LoadPlugin call. +// LoadPluginResult is the response from snap/client on a LoadPlugin call. type LoadPluginResult struct { LoadedPlugins []LoadedPlugin - Err perror.PulseError + Err perror.SnapError } -// UnloadPluginResponse is the response from pulse/client on an UnloadPlugin call. +// UnloadPluginResponse is the response from snap/client on an UnloadPlugin call. type UnloadPluginResult struct { *rbody.PluginUnloaded Err error diff --git a/mgmt/rest/client/task.go b/mgmt/rest/client/task.go index 6396da318..c5b5daa21 100644 --- a/mgmt/rest/client/task.go +++ b/mgmt/rest/client/task.go @@ -27,9 +27,9 @@ import ( "net/http" "time" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/rest/request" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/request" + "github.com/intelsdi-x/snap/scheduler/wmap" ) type Schedule struct { @@ -265,13 +265,13 @@ func (c *Client) EnableTask(id string) *EnableTaskResult { } } -// CreateTaskResult is the response from pulse/client on a CreateTask call. +// CreateTaskResult is the response from snap/client on a CreateTask call. type CreateTaskResult struct { *rbody.AddScheduledTask Err error } -// WatchTaskResult is the response from pulse/client on a WatchTask call. +// WatchTaskResult is the response from snap/client on a WatchTask call. type WatchTasksResult struct { count int Err error @@ -283,37 +283,37 @@ func (w *WatchTasksResult) Close() { close(w.DoneChan) } -// GetTasksResult is the response from pulse/client on a GetTasks call. +// GetTasksResult is the response from snap/client on a GetTasks call. type GetTasksResult struct { *rbody.ScheduledTaskListReturned Err error } -// GetTaskResult is the response from pulse/client on a GetTask call. +// GetTaskResult is the response from snap/client on a GetTask call. type GetTaskResult struct { *rbody.ScheduledTaskReturned Err error } -// StartTasksResult is the response from pulse/client on a StartTask call. +// StartTasksResult is the response from snap/client on a StartTask call. type StartTasksResult struct { *rbody.ScheduledTaskStarted Err error } -// StopTasksResult is the response from pulse/client on a StopTask call. +// StopTasksResult is the response from snap/client on a StopTask call. type StopTasksResult struct { *rbody.ScheduledTaskStopped Err error } -// RemoveTasksResult is the response from pulse/client on a RemoveTask call. +// RemoveTasksResult is the response from snap/client on a RemoveTask call. type RemoveTasksResult struct { *rbody.ScheduledTaskRemoved Err error } -// EnableTasksResult is the response from pulse/client on a EnableTask call. +// EnableTasksResult is the response from snap/client on a EnableTask call. type EnableTaskResult struct { *rbody.ScheduledTaskEnabled Err error diff --git a/mgmt/rest/client/tribe.go b/mgmt/rest/client/tribe.go index 57e542fff..b02d2e496 100644 --- a/mgmt/rest/client/tribe.go +++ b/mgmt/rest/client/tribe.go @@ -23,7 +23,7 @@ import ( "encoding/json" "fmt" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) // ListMembers retrieves a list of tribe members through an HTTP GET call. @@ -190,49 +190,49 @@ func (c *Client) LeaveAgreement(agreementName, memberName string) *LeaveAgreemen } } -// ListMembersResult is the response from pulse/client on a ListMembers call. +// ListMembersResult is the response from snap/client on a ListMembers call. type ListMembersResult struct { *rbody.TribeMemberList Err error } -// GetMemberResult is the response from pulse/client on a GetMember call. +// GetMemberResult is the response from snap/client on a GetMember call. type GetMemberResult struct { *rbody.TribeMemberShow Err error } -// AddAgreementResult is the response from pulse/client on a AddAgreement call. +// AddAgreementResult is the response from snap/client on a AddAgreement call. type AddAgreementResult struct { *rbody.TribeAddAgreement Err error } -// ListAgreementResult is the response from pulse/client on a ListAgreements call. +// ListAgreementResult is the response from snap/client on a ListAgreements call. type ListAgreementResult struct { *rbody.TribeListAgreement Err error } -// DeleteAgreementResult is the response from pulse/client on a DeleteAgreement call. +// DeleteAgreementResult is the response from snap/client on a DeleteAgreement call. type DeleteAgreementResult struct { *rbody.TribeDeleteAgreement Err error } -// GetAgreementResult is the response from pulse/client on a GetAgreement call. +// GetAgreementResult is the response from snap/client on a GetAgreement call. type GetAgreementResult struct { *rbody.TribeGetAgreement Err error } -// JoinAgreementResult is the response from pulse/client on a JoinAgreement call. +// JoinAgreementResult is the response from snap/client on a JoinAgreement call. type JoinAgreementResult struct { *rbody.TribeJoinAgreement Err error } -// LeaveAgreementResult is the response from pulse/client on a LeaveAgreement call. +// LeaveAgreementResult is the response from snap/client on a LeaveAgreement call. type LeaveAgreementResult struct { *rbody.TribeLeaveAgreement Err error diff --git a/mgmt/rest/config.go b/mgmt/rest/config.go index 2f8447819..154cf0778 100644 --- a/mgmt/rest/config.go +++ b/mgmt/rest/config.go @@ -23,9 +23,9 @@ import ( "net/http" "strconv" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" "github.com/julienschmidt/httprouter" ) diff --git a/mgmt/rest/log_handler.go b/mgmt/rest/log_handler.go index f7d89d8e5..f73aa2704 100644 --- a/mgmt/rest/log_handler.go +++ b/mgmt/rest/log_handler.go @@ -26,7 +26,7 @@ import ( "github.com/codegangsta/negroni" ) -// Logger is a Pulse middleware that logs to a logrus facility +// Logger is a snap middleware that logs to a logrus facility type Logger struct { counter uint } diff --git a/mgmt/rest/metric.go b/mgmt/rest/metric.go index 82d2e5630..8a9f13b27 100644 --- a/mgmt/rest/metric.go +++ b/mgmt/rest/metric.go @@ -27,8 +27,8 @@ import ( "github.com/julienschmidt/httprouter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) func (s *Server) getMetrics(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { diff --git a/mgmt/rest/plugin.go b/mgmt/rest/plugin.go index b78c6e363..5919d48f1 100644 --- a/mgmt/rest/plugin.go +++ b/mgmt/rest/plugin.go @@ -38,9 +38,9 @@ import ( log "github.com/Sirupsen/logrus" "github.com/julienschmidt/httprouter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" ) const PluginAlreadyLoaded = "plugin is already loaded" @@ -222,20 +222,20 @@ func (s *Server) unloadPlugin(w http.ResponseWriter, r *http.Request, p httprout if iErr != nil { pe := perror.New(errors.New("invalid version")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } if plName == "" { pe := perror.New(errors.New("missing plugin name")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } if plType == "" { pe := perror.New(errors.New("missing plugin type")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } up, pe := s.mm.Unload(&plugin{ @@ -245,7 +245,7 @@ func (s *Server) unloadPlugin(w http.ResponseWriter, r *http.Request, p httprout }) if pe != nil { pe.SetFields(f) - respond(500, rbody.FromPulseError(pe), w) + respond(500, rbody.FromSnapError(pe), w) return } pr := &rbody.PluginUnloaded{ @@ -323,20 +323,20 @@ func (s *Server) getPlugin(w http.ResponseWriter, r *http.Request, p httprouter. if iErr != nil { pe := perror.New(errors.New("invalid version")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } if plName == "" { pe := perror.New(errors.New("missing plugin name")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } if plType == "" { pe := perror.New(errors.New("missing plugin type")) pe.SetFields(f) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } @@ -352,7 +352,7 @@ func (s *Server) getPlugin(w http.ResponseWriter, r *http.Request, p httprouter. } if plugin == nil { pe := perror.New(ErrPluginNotFound, f) - respond(404, rbody.FromPulseError(pe), w) + respond(404, rbody.FromSnapError(pe), w) return } @@ -363,7 +363,7 @@ func (s *Server) getPlugin(w http.ResponseWriter, r *http.Request, p httprouter. if err != nil { f["plugin-path"] = plugin.PluginPath() pe := perror.New(err, f) - respond(500, rbody.FromPulseError(pe), w) + respond(500, rbody.FromSnapError(pe), w) return } @@ -374,7 +374,7 @@ func (s *Server) getPlugin(w http.ResponseWriter, r *http.Request, p httprouter. if err != nil { f["plugin-path"] = plugin.PluginPath() pe := perror.New(err, f) - respond(500, rbody.FromPulseError(pe), w) + respond(500, rbody.FromSnapError(pe), w) return } return diff --git a/mgmt/rest/rbody/body.go b/mgmt/rest/rbody/body.go index 05fe35dcd..837c53f2b 100644 --- a/mgmt/rest/rbody/body.go +++ b/mgmt/rest/rbody/body.go @@ -23,7 +23,7 @@ import ( "encoding/json" "errors" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/core/cdata" ) type Body interface { diff --git a/mgmt/rest/rbody/config.go b/mgmt/rest/rbody/config.go index c3d6ff96f..6bce08115 100644 --- a/mgmt/rest/rbody/config.go +++ b/mgmt/rest/rbody/config.go @@ -19,7 +19,7 @@ limitations under the License. package rbody -import "github.com/intelsdi-x/pulse/core/cdata" +import "github.com/intelsdi-x/snap/core/cdata" const ( PluginConfigItemType = "config_plugin_item_returned" diff --git a/mgmt/rest/rbody/error.go b/mgmt/rest/rbody/error.go index d7a61d014..b9746f768 100644 --- a/mgmt/rest/rbody/error.go +++ b/mgmt/rest/rbody/error.go @@ -22,7 +22,7 @@ package rbody import ( "fmt" - "github.com/intelsdi-x/pulse/core/perror" + "github.com/intelsdi-x/snap/core/perror" ) const ( @@ -35,7 +35,7 @@ type Error struct { Fields map[string]string `json:"fields"` } -func FromPulseError(pe perror.PulseError) *Error { +func FromSnapError(pe perror.SnapError) *Error { e := &Error{ErrorMessage: pe.Error(), Fields: make(map[string]string)} // Convert into string format for k, v := range pe.Fields() { @@ -44,7 +44,7 @@ func FromPulseError(pe perror.PulseError) *Error { return e } -func FromPulseErrors(errs []perror.PulseError) *Error { +func FromSnapErrors(errs []perror.SnapError) *Error { fields := make(map[string]string) var msg string for i, err := range errs { diff --git a/mgmt/rest/rbody/task.go b/mgmt/rest/rbody/task.go index fe6ea004c..22c2ee6ec 100644 --- a/mgmt/rest/rbody/task.go +++ b/mgmt/rest/rbody/task.go @@ -24,10 +24,10 @@ import ( "fmt" "time" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/mgmt/rest/request" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/mgmt/rest/request" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) const ( diff --git a/mgmt/rest/rbody/tribe.go b/mgmt/rest/rbody/tribe.go index 238b1c480..3a9e8974d 100644 --- a/mgmt/rest/rbody/tribe.go +++ b/mgmt/rest/rbody/tribe.go @@ -19,7 +19,7 @@ limitations under the License. package rbody -import "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" +import "github.com/intelsdi-x/snap/mgmt/tribe/agreement" const ( TribeListAgreementType = "tribe_agreement_list_returned" diff --git a/mgmt/rest/readme.md b/mgmt/rest/readme.md index 0be787f37..60bbbd524 100644 --- a/mgmt/rest/readme.md +++ b/mgmt/rest/readme.md @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -Pulse REST API +snap REST API Task Schema diff --git a/mgmt/rest/request/task.go b/mgmt/rest/request/task.go index e4a8a8fe8..80c3fb82d 100644 --- a/mgmt/rest/request/task.go +++ b/mgmt/rest/request/task.go @@ -20,7 +20,7 @@ limitations under the License. package request import ( - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/scheduler/wmap" ) type TaskCreationRequest struct { diff --git a/mgmt/rest/rest_func_test.go b/mgmt/rest/rest_func_test.go index 49b88643d..0080573e7 100644 --- a/mgmt/rest/rest_func_test.go +++ b/mgmt/rest/rest_func_test.go @@ -38,14 +38,14 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/rest/request" - "github.com/intelsdi-x/pulse/scheduler" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/request" + "github.com/intelsdi-x/snap/scheduler" + "github.com/intelsdi-x/snap/scheduler/wmap" . "github.com/smartystreets/goconvey/convey" ) @@ -53,10 +53,10 @@ var ( // Switching this turns on logging for all the REST API calls LOG_LEVEL = log.WarnLevel - PULSE_PATH = os.Getenv("PULSE_PATH") - MOCK_PLUGIN_PATH1 = PULSE_PATH + "/plugin/pulse-collector-mock1" - MOCK_PLUGIN_PATH2 = PULSE_PATH + "/plugin/pulse-collector-mock2" - FILE_PLUGIN_PATH = PULSE_PATH + "/plugin/pulse-publisher-file" + SNAP_PATH = os.Getenv("SNAP_PATH") + MOCK_PLUGIN_PATH1 = SNAP_PATH + "/plugin/snap-collector-mock1" + MOCK_PLUGIN_PATH2 = SNAP_PATH + "/plugin/snap-collector-mock2" + FILE_PLUGIN_PATH = SNAP_PATH + "/plugin/snap-publisher-file" CompressedUpload = true TotalUploadSize = 0 @@ -284,7 +284,7 @@ func uploadPlugin(pluginPath string, port int) *rbody.APIResponse { body := &bytes.Buffer{} writer := multipart.NewWriter(body) var part io.Writer - part, err = writer.CreateFormFile("pulse-plugins", filepath.Base(pluginPath)) + part, err = writer.CreateFormFile("snap-plugins", filepath.Base(pluginPath)) if err != nil { log.Fatal(err) } @@ -538,7 +538,7 @@ func TestPluginRestCalls(t *testing.T) { }) Convey("Plugin config is set at startup", func() { cfg := control.NewConfig() - b, err := ioutil.ReadFile("../../examples/configs/pulse-config-sample.json") + b, err := ioutil.ReadFile("../../examples/configs/snap-config-sample.json") So(err, ShouldBeNil) json.Unmarshal(b, cfg) r := startAPI(control.OptSetConfig(cfg)) diff --git a/mgmt/rest/server.go b/mgmt/rest/server.go index 82214ab3e..901cba2ec 100644 --- a/mgmt/rest/server.go +++ b/mgmt/rest/server.go @@ -34,13 +34,13 @@ import ( "github.com/codegangsta/negroni" "github.com/julienschmidt/httprouter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" - cschedule "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" + cschedule "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) const ( @@ -58,8 +58,8 @@ type managesMetrics interface { MetricCatalog() ([]core.CatalogedMetric, error) FetchMetrics([]string, int) ([]core.CatalogedMetric, error) GetMetric([]string, int) (core.CatalogedMetric, error) - Load(*core.RequestedPlugin) (core.CatalogedPlugin, perror.PulseError) - Unload(core.Plugin) (core.CatalogedPlugin, perror.PulseError) + Load(*core.RequestedPlugin) (core.CatalogedPlugin, perror.SnapError) + Unload(core.Plugin) (core.CatalogedPlugin, perror.SnapError) PluginCatalog() core.PluginCatalog AvailablePlugins() []core.AvailablePlugin GetAutodiscoverPaths() []string @@ -69,20 +69,20 @@ type managesTasks interface { CreateTask(cschedule.Schedule, *wmap.WorkflowMap, bool, ...core.TaskOption) (core.Task, core.TaskErrors) GetTasks() map[string]core.Task GetTask(string) (core.Task, error) - StartTask(string) []perror.PulseError - StopTask(string) []perror.PulseError + StartTask(string) []perror.SnapError + StopTask(string) []perror.SnapError RemoveTask(string) error WatchTask(string, core.TaskWatcherHandler) (core.TaskWatcherCloser, error) EnableTask(string) (core.Task, error) } type managesTribe interface { - GetAgreement(name string) (*agreement.Agreement, perror.PulseError) + GetAgreement(name string) (*agreement.Agreement, perror.SnapError) GetAgreements() map[string]*agreement.Agreement - AddAgreement(name string) perror.PulseError - RemoveAgreement(name string) perror.PulseError - JoinAgreement(agreementName, memberName string) perror.PulseError - LeaveAgreement(agreementName, memberName string) perror.PulseError + AddAgreement(name string) perror.SnapError + RemoveAgreement(name string) perror.SnapError + JoinAgreement(agreementName, memberName string) perror.SnapError + LeaveAgreement(agreementName, memberName string) perror.SnapError GetMembers() []string GetMember(name string) *agreement.Member } diff --git a/mgmt/rest/task.go b/mgmt/rest/task.go index 19a6bde08..7fbeea8f0 100644 --- a/mgmt/rest/task.go +++ b/mgmt/rest/task.go @@ -31,11 +31,11 @@ import ( log "github.com/Sirupsen/logrus" "github.com/julienschmidt/httprouter" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/rest/request" - cschedule "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/rest/request" + cschedule "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) var ( @@ -237,10 +237,10 @@ func (s *Server) startTask(w http.ResponseWriter, r *http.Request, p httprouter. errs := s.mt.StartTask(id) if errs != nil { if strings.Contains(errs[0].Error(), ErrTaskNotFound.Error()) { - respond(404, rbody.FromPulseErrors(errs), w) + respond(404, rbody.FromSnapErrors(errs), w) return } - respond(500, rbody.FromPulseErrors(errs), w) + respond(500, rbody.FromSnapErrors(errs), w) return } // TODO should return resource @@ -252,10 +252,10 @@ func (s *Server) stopTask(w http.ResponseWriter, r *http.Request, p httprouter.P errs := s.mt.StopTask(id) if errs != nil { if strings.Contains(errs[0].Error(), ErrTaskNotFound.Error()) { - respond(404, rbody.FromPulseErrors(errs), w) + respond(404, rbody.FromSnapErrors(errs), w) return } - respond(500, rbody.FromPulseErrors(errs), w) + respond(500, rbody.FromSnapErrors(errs), w) return } respond(200, &rbody.ScheduledTaskStopped{ID: id}, w) diff --git a/mgmt/rest/tls.go b/mgmt/rest/tls.go index c38b34553..65d6986b3 100644 --- a/mgmt/rest/tls.go +++ b/mgmt/rest/tls.go @@ -92,7 +92,7 @@ func generateCert(t *tls) error { temp := &x509.Certificate{ SerialNumber: serialNumber, Subject: pkix.Name{ - Organization: []string{"Local Pulse Agent"}, + Organization: []string{"Local snap Agent"}, }, DNSNames: []string{"localhost"}, NotBefore: notBefore, diff --git a/mgmt/rest/tribe.go b/mgmt/rest/tribe.go index 273d2a0a5..85e00db46 100644 --- a/mgmt/rest/tribe.go +++ b/mgmt/rest/tribe.go @@ -27,8 +27,8 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" "github.com/julienschmidt/httprouter" ) @@ -56,15 +56,15 @@ func (s *Server) getAgreement(w http.ResponseWriter, r *http.Request, p httprout "agreement_name": name, } tribeLogger.WithFields(fields).Error(ErrAgreementDoesNotExist) - respond(400, rbody.FromPulseError(perror.New(ErrAgreementDoesNotExist, fields)), w) + respond(400, rbody.FromSnapError(perror.New(ErrAgreementDoesNotExist, fields)), w) return } a := &rbody.TribeGetAgreement{} - var perr perror.PulseError + var perr perror.SnapError a.Agreement, perr = s.tr.GetAgreement(name) if perr != nil { tribeLogger.Error(perr) - respond(400, rbody.FromPulseError(perr), w) + respond(400, rbody.FromSnapError(perr), w) return } respond(200, a, w) @@ -78,15 +78,15 @@ func (s *Server) deleteAgreement(w http.ResponseWriter, r *http.Request, p httpr "agreement_name": name, } tribeLogger.WithFields(fields).Error(ErrAgreementDoesNotExist) - respond(400, rbody.FromPulseError(perror.New(ErrAgreementDoesNotExist, fields)), w) + respond(400, rbody.FromSnapError(perror.New(ErrAgreementDoesNotExist, fields)), w) return } - var perr perror.PulseError + var perr perror.SnapError perr = s.tr.RemoveAgreement(name) if perr != nil { tribeLogger.Error(perr) - respond(400, rbody.FromPulseError(perr), w) + respond(400, rbody.FromSnapError(perr), w) return } @@ -103,7 +103,7 @@ func (s *Server) joinAgreement(w http.ResponseWriter, r *http.Request, p httprou "agreement_name": name, } tribeLogger.WithFields(fields).Error(ErrAgreementDoesNotExist) - respond(400, rbody.FromPulseError(perror.New(ErrAgreementDoesNotExist, fields)), w) + respond(400, rbody.FromSnapError(perror.New(ErrAgreementDoesNotExist, fields)), w) return } @@ -125,14 +125,14 @@ func (s *Server) joinAgreement(w http.ResponseWriter, r *http.Request, p httprou } pe := perror.New(ErrInvalidJSON, fields) tribeLogger.WithFields(fields).Error(ErrInvalidJSON) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } perr := s.tr.JoinAgreement(name, m.MemberName) if perr != nil { tribeLogger.Error(perr) - respond(400, rbody.FromPulseError(perr), w) + respond(400, rbody.FromSnapError(perr), w) return } agreement, _ := s.tr.GetAgreement(name) @@ -148,7 +148,7 @@ func (s *Server) leaveAgreement(w http.ResponseWriter, r *http.Request, p httpro "agreement_name": name, } tribeLogger.WithFields(fields).Error(ErrAgreementDoesNotExist) - respond(400, rbody.FromPulseError(perror.New(ErrAgreementDoesNotExist, fields)), w) + respond(400, rbody.FromSnapError(perror.New(ErrAgreementDoesNotExist, fields)), w) return } @@ -170,14 +170,14 @@ func (s *Server) leaveAgreement(w http.ResponseWriter, r *http.Request, p httpro } pe := perror.New(ErrInvalidJSON, fields) tribeLogger.WithFields(fields).Error(ErrInvalidJSON) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } perr := s.tr.LeaveAgreement(name, m.MemberName) if perr != nil { tribeLogger.Error(perr) - respond(400, rbody.FromPulseError(perr), w) + respond(400, rbody.FromSnapError(perr), w) return } agreement, _ := s.tr.GetAgreement(name) @@ -198,7 +198,7 @@ func (s *Server) getMember(w http.ResponseWriter, r *http.Request, p httprouter. "name": name, } tribeLogger.WithFields(fields).Error(ErrMemberNotFound) - respond(404, rbody.FromPulseError(perror.New(ErrMemberNotFound, fields)), w) + respond(404, rbody.FromSnapError(perror.New(ErrMemberNotFound, fields)), w) return } resp := &rbody.TribeMemberShow{ @@ -234,7 +234,7 @@ func (s *Server) addAgreement(w http.ResponseWriter, r *http.Request, p httprout } pe := perror.New(ErrInvalidJSON, fields) tribeLogger.WithFields(fields).Error(ErrInvalidJSON) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } @@ -244,7 +244,7 @@ func (s *Server) addAgreement(w http.ResponseWriter, r *http.Request, p httprout } pe := perror.New(ErrInvalidJSON, fields) tribeLogger.WithFields(fields).Error(ErrInvalidJSON) - respond(400, rbody.FromPulseError(pe), w) + respond(400, rbody.FromSnapError(pe), w) return } diff --git a/mgmt/rest/tribe_test.go b/mgmt/rest/tribe_test.go index 8885a6f91..2a169421f 100644 --- a/mgmt/rest/tribe_test.go +++ b/mgmt/rest/tribe_test.go @@ -34,11 +34,11 @@ import ( log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/mgmt/rest/rbody" - "github.com/intelsdi-x/pulse/mgmt/tribe" - "github.com/intelsdi-x/pulse/scheduler" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/mgmt/rest/rbody" + "github.com/intelsdi-x/snap/mgmt/tribe" + "github.com/intelsdi-x/snap/scheduler" ) func getMembers(port int) *rbody.APIResponse { diff --git a/mgmt/tribe/agreement/agreement.go b/mgmt/tribe/agreement/agreement.go index 49573cd25..1a0b8f346 100644 --- a/mgmt/tribe/agreement/agreement.go +++ b/mgmt/tribe/agreement/agreement.go @@ -25,7 +25,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/hashicorp/memberlist" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" ) const ( diff --git a/mgmt/tribe/flags.go b/mgmt/tribe/flags.go index abf96e8fa..769572bf2 100644 --- a/mgmt/tribe/flags.go +++ b/mgmt/tribe/flags.go @@ -31,38 +31,38 @@ var ( flTribeNodeName = cli.StringFlag{ Name: "tribe-node-name", Usage: "Name of this node in tribe cluster (default: hostname)", - EnvVar: "PULSE_TRIBE_NODE_NAME", + EnvVar: "SNAP_TRIBE_NODE_NAME", Value: getHostname(), } flTribe = cli.BoolFlag{ Name: "tribe", Usage: `Enable tribe mode`, - EnvVar: "PULSE_TRIBE", + EnvVar: "SNAP_TRIBE", } flTribeSeed = cli.StringFlag{ Name: "tribe-seed", Usage: "IP (or hostname) and port of a node to join (e.g. 127.0.0.1:6000)", - EnvVar: "PULSE_TRIBE_SEED", + EnvVar: "SNAP_TRIBE_SEED", Value: "", } flTribeAdvertisePort = cli.IntFlag{ Name: "tribe-port", Usage: "Port tribe gossips over to maintain membership", - EnvVar: "PULSE_TRIBE_PORT", + EnvVar: "SNAP_TRIBE_PORT", Value: 6000, } flTribeAdvertiseAddr = cli.StringFlag{ Name: "tribe-addr", Usage: "Addr tribe gossips over to maintain membership", - EnvVar: "PULSE_TRIBE_ADDR", + EnvVar: "SNAP_TRIBE_ADDR", Value: getIP(), } - // Flags consumed by pulsed + // Flags consumed by snapd Flags = []cli.Flag{flTribeNodeName, flTribe, flTribeSeed, flTribeAdvertiseAddr, flTribeAdvertisePort} ) diff --git a/mgmt/tribe/messages.go b/mgmt/tribe/messages.go index 44c142100..9cd49eb30 100644 --- a/mgmt/tribe/messages.go +++ b/mgmt/tribe/messages.go @@ -25,8 +25,8 @@ import ( "time" "github.com/hashicorp/go-msgpack/codec" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" ) type msgType uint8 diff --git a/mgmt/tribe/query.go b/mgmt/tribe/query.go index d28a785cb..f8611929c 100644 --- a/mgmt/tribe/query.go +++ b/mgmt/tribe/query.go @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" ) const ( diff --git a/mgmt/tribe/tribe.go b/mgmt/tribe/tribe.go index 99b7e5f6d..e2f7443ec 100644 --- a/mgmt/tribe/tribe.go +++ b/mgmt/tribe/tribe.go @@ -31,12 +31,12 @@ import ( log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/control_event" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/core/scheduler_event" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" - "github.com/intelsdi-x/pulse/mgmt/tribe/worker" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/control_event" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/core/scheduler_event" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" + "github.com/intelsdi-x/snap/mgmt/tribe/worker" "github.com/pborman/uuid" "github.com/hashicorp/go-msgpack/codec" @@ -477,7 +477,7 @@ func (t *tribe) GetMembers() []string { return members } -func (t *tribe) LeaveAgreement(agreementName, memberName string) perror.PulseError { +func (t *tribe) LeaveAgreement(agreementName, memberName string) perror.SnapError { if err := t.canLeaveAgreement(agreementName, memberName); err != nil { return err } @@ -495,7 +495,7 @@ func (t *tribe) LeaveAgreement(agreementName, memberName string) perror.PulseErr return nil } -func (t *tribe) JoinAgreement(agreementName, memberName string) perror.PulseError { +func (t *tribe) JoinAgreement(agreementName, memberName string) perror.SnapError { if err := t.canJoinAgreement(agreementName, memberName); err != nil { return err } @@ -547,7 +547,7 @@ func (t *tribe) RemovePlugin(agreementName string, p agreement.Plugin) error { return nil } -func (t *tribe) GetAgreement(name string) (*agreement.Agreement, perror.PulseError) { +func (t *tribe) GetAgreement(name string) (*agreement.Agreement, perror.SnapError) { a, ok := t.agreements[name] if !ok { return nil, perror.New(errAgreementDoesNotExist, map[string]interface{}{"agreement_name": name}) @@ -559,7 +559,7 @@ func (t *tribe) GetAgreements() map[string]*agreement.Agreement { return t.agreements } -func (t *tribe) AddTask(agreementName string, task agreement.Task) perror.PulseError { +func (t *tribe) AddTask(agreementName string, task agreement.Task) perror.SnapError { if err := t.canAddTask(task, agreementName); err != nil { return err } @@ -577,7 +577,7 @@ func (t *tribe) AddTask(agreementName string, task agreement.Task) perror.PulseE return nil } -func (t *tribe) RemoveTask(agreementName string, task agreement.Task) perror.PulseError { +func (t *tribe) RemoveTask(agreementName string, task agreement.Task) perror.SnapError { if err := t.canStartStopRemoveTask(task, agreementName); err != nil { return err } @@ -594,7 +594,7 @@ func (t *tribe) RemoveTask(agreementName string, task agreement.Task) perror.Pul return nil } -func (t *tribe) StopTask(agreementName string, task agreement.Task) perror.PulseError { +func (t *tribe) StopTask(agreementName string, task agreement.Task) perror.SnapError { if err := t.canStartStopRemoveTask(task, agreementName); err != nil { return err } @@ -611,7 +611,7 @@ func (t *tribe) StopTask(agreementName string, task agreement.Task) perror.Pulse return nil } -func (t *tribe) StartTask(agreementName string, task agreement.Task) perror.PulseError { +func (t *tribe) StartTask(agreementName string, task agreement.Task) perror.SnapError { if err := t.canStartStopRemoveTask(task, agreementName); err != nil { return err } @@ -629,7 +629,7 @@ func (t *tribe) StartTask(agreementName string, task agreement.Task) perror.Puls return nil } -func (t *tribe) AddAgreement(name string) perror.PulseError { +func (t *tribe) AddAgreement(name string) perror.SnapError { if _, ok := t.agreements[name]; ok { fields := log.Fields{ "agreement": name, @@ -648,7 +648,7 @@ func (t *tribe) AddAgreement(name string) perror.PulseError { return nil } -func (t *tribe) RemoveAgreement(name string) perror.PulseError { +func (t *tribe) RemoveAgreement(name string) perror.SnapError { if _, ok := t.agreements[name]; !ok { fields := log.Fields{ "Agreement": name, @@ -1294,7 +1294,7 @@ func (t *tribe) registerQueryResponse(timeout time.Duration, resp *taskStateQuer }) } -func (t *tribe) joinAgreement(msg *agreementMsg) perror.PulseError { +func (t *tribe) joinAgreement(msg *agreementMsg) perror.SnapError { if err := t.canJoinAgreement(msg.Agreement(), msg.MemberName); err != nil { return err } @@ -1343,7 +1343,7 @@ func (t *tribe) joinAgreement(msg *agreementMsg) perror.PulseError { return nil } -func (t *tribe) leaveAgreement(msg *agreementMsg) perror.PulseError { +func (t *tribe) leaveAgreement(msg *agreementMsg) perror.SnapError { if err := t.canLeaveAgreement(msg.Agreement(), msg.MemberName); err != nil { return err } @@ -1357,7 +1357,7 @@ func (t *tribe) leaveAgreement(msg *agreementMsg) perror.PulseError { return nil } -func (t *tribe) canLeaveAgreement(agreementName, memberName string) perror.PulseError { +func (t *tribe) canLeaveAgreement(agreementName, memberName string) perror.SnapError { fields := log.Fields{ "member-name": memberName, "agreement": agreementName, @@ -1378,7 +1378,7 @@ func (t *tribe) canLeaveAgreement(agreementName, memberName string) perror.Pulse return nil } -func (t *tribe) canJoinAgreement(agreementName, memberName string) perror.PulseError { +func (t *tribe) canJoinAgreement(agreementName, memberName string) perror.SnapError { fields := log.Fields{ "member-name": memberName, "agreement": agreementName, @@ -1400,7 +1400,7 @@ func (t *tribe) canJoinAgreement(agreementName, memberName string) perror.PulseE return nil } -func (t *tribe) canAddTask(task agreement.Task, agreementName string) perror.PulseError { +func (t *tribe) canAddTask(task agreement.Task, agreementName string) perror.SnapError { fields := log.Fields{ "agreement": agreementName, "task-id": task.ID, @@ -1417,7 +1417,7 @@ func (t *tribe) canAddTask(task agreement.Task, agreementName string) perror.Pul return nil } -func (t *tribe) canStartStopRemoveTask(task agreement.Task, agreementName string) perror.PulseError { +func (t *tribe) canStartStopRemoveTask(task agreement.Task, agreementName string) perror.SnapError { fields := log.Fields{ "agreement": agreementName, "task-id": task.ID, diff --git a/mgmt/tribe/tribe_test.go b/mgmt/tribe/tribe_test.go index 06845a9fd..bf50e0453 100644 --- a/mgmt/tribe/tribe_test.go +++ b/mgmt/tribe/tribe_test.go @@ -29,11 +29,11 @@ import ( "time" log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" "github.com/pborman/uuid" . "github.com/smartystreets/goconvey/convey" @@ -45,9 +45,9 @@ func (m *mockTaskManager) GetTask(id string) (core.Task, error) { return &mockTa func (m *mockTaskManager) CreateTaskTribe(sch schedule.Schedule, wfMap *wmap.WorkflowMap, startOnCreate bool, opts ...core.TaskOption) (core.Task, core.TaskErrors) { return nil, nil } -func (m *mockTaskManager) StopTaskTribe(id string) []perror.PulseError { return nil } -func (m *mockTaskManager) StartTaskTribe(id string) []perror.PulseError { return nil } -func (m *mockTaskManager) RemoveTaskTribe(id string) error { return nil } +func (m *mockTaskManager) StopTaskTribe(id string) []perror.SnapError { return nil } +func (m *mockTaskManager) StartTaskTribe(id string) []perror.SnapError { return nil } +func (m *mockTaskManager) RemoveTaskTribe(id string) error { return nil } type mockTask struct{} diff --git a/mgmt/tribe/worker/worker.go b/mgmt/tribe/worker/worker.go index c83ca0596..35dc1f762 100644 --- a/mgmt/tribe/worker/worker.go +++ b/mgmt/tribe/worker/worker.go @@ -33,13 +33,13 @@ import ( "time" log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest/client" - "github.com/intelsdi-x/pulse/mgmt/rest/request" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest/client" + "github.com/intelsdi-x/snap/mgmt/rest/request" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler" + "github.com/intelsdi-x/snap/scheduler/wmap" ) const ( @@ -103,16 +103,16 @@ type Task struct { } type ManagesPlugins interface { - Load(*core.RequestedPlugin) (core.CatalogedPlugin, perror.PulseError) - Unload(plugin core.Plugin) (core.CatalogedPlugin, perror.PulseError) + Load(*core.RequestedPlugin) (core.CatalogedPlugin, perror.SnapError) + Unload(plugin core.Plugin) (core.CatalogedPlugin, perror.SnapError) PluginCatalog() core.PluginCatalog } type ManagesTasks interface { GetTask(id string) (core.Task, error) CreateTaskTribe(sch schedule.Schedule, wfMap *wmap.WorkflowMap, startOnCreate bool, opts ...core.TaskOption) (core.Task, core.TaskErrors) - StopTaskTribe(id string) []perror.PulseError - StartTaskTribe(id string) []perror.PulseError + StopTaskTribe(id string) []perror.SnapError + StartTaskTribe(id string) []perror.SnapError RemoveTaskTribe(id string) error } diff --git a/mgmt/tribe/worker/worker_test.go b/mgmt/tribe/worker/worker_test.go index 3aa5eacc9..a95d5b4ab 100644 --- a/mgmt/tribe/worker/worker_test.go +++ b/mgmt/tribe/worker/worker_test.go @@ -27,17 +27,17 @@ package worker // log "github.com/Sirupsen/logrus" // . "github.com/smartystreets/goconvey/convey" // -// "github.com/intelsdi-x/pulse/core" -// "github.com/intelsdi-x/pulse/core/perror" +// "github.com/intelsdi-x/snap/core" +// "github.com/intelsdi-x/snap/core/perror" // ) // // type mockPluginManager struct{} // -// func (m *mockPluginManager) Load(path string) (core.CatalogedPlugin, perror.PulseError) { +// func (m *mockPluginManager) Load(path string) (core.CatalogedPlugin, perror.SnapError) { // return nil, nil // } // -// func (m *mockPluginManager) Unload(plugin core.Plugin) (core.CatalogedPlugin, perror.PulseError) { +// func (m *mockPluginManager) Unload(plugin core.Plugin) (core.CatalogedPlugin, perror.SnapError) { // return nil, nil // } // diff --git a/pkg/psigning/README.md b/pkg/psigning/README.md index 1013c7405..372cc2250 100644 --- a/pkg/psigning/README.md +++ b/pkg/psigning/README.md @@ -1,77 +1,77 @@ Plugin Signing ============== # Security -By default, the Pulse Daemon has plugin signing verification enabled. To disable it or turn it to warning, the flag `--plugin-trust, -t` can be set to 0 or 2 respectively. +By default, the snap Daemon has plugin signing verification enabled. To disable it or turn it to warning, the flag `--plugin-trust, -t` can be set to 0 or 2 respectively. ##How it works ![How it works](https://cloud.githubusercontent.com/assets/12282848/10112575/19bec0f4-6391-11e5-8f27-7a1a057122fd.png) Private/public keys and keyrings are generated by GPG. The plugin is signed with the private key and the public key needs to be added to the user's keyring. The signing is an armored detached signature in the form of a `.asc` file. -The Pulse Daemon uses the Golang OpenPGP library's `CheckArmoredDetachedSignature` function to validate the signature using the keyring, plugin, and signature file before loading the plugin. It checks the issuer key ID, hash, and signature type. +The snap Daemon uses the Golang OpenPGP library's `CheckArmoredDetachedSignature` function to validate the signature using the keyring, plugin, and signature file before loading the plugin. It checks the issuer key ID, hash, and signature type. ```go openpgp.CheckArmoredDetachedSignature(keyring, signed, signature) ``` ##Usage ``` -pulsed - --plugin-trust, -t '1' 0-2 (Disabled, Enabled, Warning) [$PULSE_TRUST_LEVEL] - --keyring-files, -k Keyring files for signing verification separated by colons [$PULSE_KEYRING_FILES] +snapd + --plugin-trust, -t '1' 0-2 (Disabled, Enabled, Warning) [$SNAP_TRUST_LEVEL] + --keyring-files, -k Keyring files for signing verification separated by colons [$SNAP_KEYRING_FILES] ``` One keyring (-t flag is not needed for signing enabled) ``` -pulsed -k -pulsed -t -k -pulsed -t -k someDirectory/someFile.gpg -pulsed -t -k someDirectory/ +snapd -k +snapd -t -k +snapd -t -k someDirectory/someFile.gpg +snapd -t -k someDirectory/ ``` Multiple keyrings (may need full path, not ~) ``` -pulsed -t -k : +snapd -t -k : ``` By default, plugin-trust is 1 (enabled), so the flag is only needed for 0 (disabled) and 2 (warning) You can make an export to avoid needing the `-k` flag: ``` -export PULSE_KEYRING_FILE= -pulsed -t +export SNAP_KEYRING_FILE= +snapd -t ``` -Loading a single plugin in pulsectl +Loading a single plugin in snapctl ``` -pulsectl plugin load -a .asc +snapctl plugin load -a .asc ``` ####Examples #####No keyring, trust enabled/warning ``` -> pulsed -l 1 +> snapd -l 1 INFO[0000] setting plugin trust level to: enabled -FATA[0000] need keyring file when trust is on (--keyring-file or -k) _module=pulsed block=main +FATA[0000] need keyring file when trust is on (--keyring-file or -k) _module=snapd block=main ``` #####Invalid Keyring Keyring doesn't exist ``` -> pulsed -l 1 -k /Users/tiffany/.gnupg/pubring.gpg:/Users/tiffany/.gnupg/stuff.gpg +> snapd -l 1 -k /Users/tiffany/.gnupg/pubring.gpg:/Users/tiffany/.gnupg/stuff.gpg INFO[0000] adding keyring file /Users/tiffany/.gnupg/pubring.gpg -FATA[0000] bad keyring file _module=pulsed block=main error=stat /Users/tiffany/.gnupg/stuff.gpg: no such file or directory keyringPath=/Users/tiffany/.gnupg/stuff.gpg +FATA[0000] bad keyring file _module=snapd block=main error=stat /Users/tiffany/.gnupg/stuff.gpg: no such file or directory keyringPath=/Users/tiffany/.gnupg/stuff.gpg ``` #####Correct Keyring, trust enabled Valid signature ``` -> pulsed -l 1 -k /Users/tiffany/.gnupg/ +> snapd -l 1 -k /Users/tiffany/.gnupg/ INFO[0000] setting plugin trust level to: enabled INFO[0000] Adding keyrings from: /Users/tiffany/.gnupg INFO[0000] adding keyring file: /Users/tiffany/.gnupg/pubkeys.gpg INFO[0000] adding keyring file: /Users/tiffany/.gnupg/pubkeys2.gpg INFO[0000] adding keyring file: /Users/tiffany/.gnupg/pubring.gpg -INFO[0000] adding keyring file: /Users/tiffany/.gnupg/pulse.pubring +INFO[0000] adding keyring file: /Users/tiffany/.gnupg/snap.pubring INFO[0000] adding keyring file: /Users/tiffany/.gnupg/secring.gpg INFO[0000] adding keyring file: /Users/tiffany/.gnupg/trustdb.gpg ``` ``` -> pulsectl plugin load build/plugin/pulse-collector-mock1 -a build/plugin/pulse-collector-mock1.asc +> snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc Plugin loaded Name: mock1 Version: 1 @@ -81,62 +81,62 @@ Loaded Time: Thu, 12 Nov 2015 13:53:58 PST ``` ``` INFO[0036] API request _module=_mgmt-rest index=3 method=POST url=/v1/plugins -DEBU[0037] wrote 7332032 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/pulse-collector-mock1 -DEBU[0037] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/784063842/pulse-collector-mock1.asc -INFO[0037] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/pulse-collector-mock1 _module=_mgmt-rest +DEBU[0037] wrote 7332032 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-collector-mock1 +DEBU[0037] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/784063842/snap-collector-mock1.asc +INFO[0037] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/485061199/snap-collector-mock1 _module=_mgmt-rest Signature made Thu, 12 Nov 2015 13:53:58 PST using RSA key ID 43F744A0 Good signature from Tiffany Jernigan (Main signing key) ``` No signature ``` -> pulsectl plugin load build/plugin/pulse-collector-mock2 +> snapctl plugin load build/plugin/snap-collector-mock2 Error loading plugin: Signature file (.asc) not found: open : no such file or directory ``` ``` -DEBU[0033] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/pulse-collector-mock2 -INFO[0033] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/pulse-collector-mock2 _module=_mgmt-rest +DEBU[0033] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2 +INFO[0033] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2 _module=_mgmt-rest ERRO[0033] Signature file (.asc) not found: open : no such file or directory _module=_mgmt-rest -DEBU[0033] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/pulse-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/pulse-collector-mock2) _module=_mgmt-rest +DEBU[0033] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/180549107/snap-collector-mock2) _module=_mgmt-rest ``` Invalid signature ``` -pulsectl plugin load build/plugin/pulse-collector-mock2 -a build/plugin/pulse-collector-mock1.asc +snapctl plugin load build/plugin/snap-collector-mock2 -a build/plugin/snap-collector-mock1.asc Error loading plugin: Error checking signature openpgp: invalid signature: hash tag doesn't match ``` ``` -DEBU[0003] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/pulse-collector-mock2 -DEBU[0003] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/pulse-collector-mock1.asc -INFO[0003] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/pulse-collector-mock2 _module=_mgmt-rest +DEBU[0003] wrote 7327840 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2 +DEBU[0003] wrote 473 to /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-collector-mock1.asc +INFO[0003] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2 _module=_mgmt-rest ERRO[0003] Error checking signature openpgp: invalid signature: hash tag doesn't match _module=_mgmt-rest -DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/pulse-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/pulse-collector-mock2) _module=_mgmt-rest -DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/pulse-collector-mock1.asc) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/pulse-collector-mock2) _module=_mgmt-rest +DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) _module=_mgmt-rest +DEBU[0003] Removing file (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/700509798/snap-collector-mock1.asc) after failure to load plugin (/var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/719702627/snap-collector-mock2) _module=_mgmt-rest ``` Wrong keyring ``` -> pulsectl plugin load build/plugin/pulse-collector-mock1 -a build/plugin/pulse-collector-mock1.asc +> snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc Error loading plugin: Error checking signature openpgp: signature made by unknown entity ``` ``` -INFO[0002] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/057449871/pulse-collector-mock1 _module=_mgmt-rest +INFO[0002] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/057449871/snap-collector-mock1 _module=_mgmt-rest ERRO[0002] Error checking signature openpgp: signature made by unknown entity _module=_mgmt-rest ``` #####Correct keyring, trust warning ``` -> pulsed -l 1 -k ~/.gnupg/pubring.gpg -t 2 +> snapd -l 1 -k ~/.gnupg/pubring.gpg -t 2 INFO[0000] setting plugin trust level to: warning INFO[0000] adding keyring file /Users/tiffany/.gnupg/pubring.gpg ``` ``` -> pulsectl plugin load build/plugin/pulse-collector-mock1 -a build/plugin/pulse-collector-mock1.asc +> snapctl plugin load build/plugin/snap-collector-mock1 -a build/plugin/snap-collector-mock1.asc Plugin loaded Name: mock1 @@ -145,7 +145,7 @@ Type: collector Signed: true Loaded Time: Thu, 12 Nov 2015 14:08:32 PST -> pulsectl plugin load build/plugin/pulse-collector-mock2 +> snapctl plugin load build/plugin/snap-collector-mock2 Plugin loaded Name: mock2 @@ -155,10 +155,10 @@ Signed: false Loaded Time: Thu, 12 Nov 2015 14:08:49 PST ``` ``` -INFO[0338] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/276797457/pulse-collector-mock1 _module=_mgmt-rest +INFO[0338] Loading plugin: /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/276797457/snap-collector-mock1 _module=_mgmt-rest Signature made Thu, 12 Nov 2015 14:08:32 PST using RSA key ID 43F744A0 Good signature from Tiffany Jernigan (ACI signing key) -WARN[0355] Loading unsigned plugin /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/205904491/pulse-collector-mock2 _block=load _module=control +WARN[0355] Loading unsigned plugin /var/folders/kh/v2qy5_zx3zlgbc0gll7fzjnm0000gp/T/205904491/snap-collector-mock2 _block=load _module=control ``` ##Creating Signing Files and Validating Signature @@ -177,9 +177,9 @@ Name-Real: Tiffany Jernigan Name-Comment: Plugin signing key Name-Email: my.email@intel.com Expire-Date: 0 -Passphrase: pulse -%pubring pulse.pubring -%secring pulse.secring +Passphrase: snap +%pubring snap.pubring +%secring snap.secring %commit %echo done ``` @@ -190,11 +190,11 @@ Passphrase: pulse #####List the keys ``` -> gpg --no-default-keyring --secret-keyring ./pulse.secring --keyring ./pulse.pubring \ +> gpg --no-default-keyring --secret-keyring ./snap.secring --keyring ./snap.pubring \ --list-keys ``` ``` -./pulse.pubring +./snap.pubring ----------- pub 2048R/FE9B5E28 2015-11-04 uid Tiffany Jernigan (Plugin signing key) @@ -203,7 +203,7 @@ sub 2048R/0BC6D4D7 2015-11-04 Since we know exactly where this key came from let's trust it: ``` -> gpg --no-default-keyring --secret-keyring ./pulse.secring --keyring ./pulse.pubring \ +> gpg --no-default-keyring --secret-keyring ./snap.secring --keyring ./snap.pubring \ --edit-key FE9B5E28 trust ``` ``` @@ -248,7 +248,7 @@ gpg> quit #####Export the public key ``` > gpg --no-default-keyring --armor \ ---secret-keyring ./pulse.secring --keyring ./pulse.pubring \ +--secret-keyring ./snap.secring --keyring ./snap.pubring \ --export my.email@intel.com > pubkeys.gpg ``` @@ -256,14 +256,14 @@ gpg> quit #####Sign file ``` > gpg --no-default-keyring --armor \ ---secret-keyring ./pulse.secring --keyring ./pulse.pubring \ +--secret-keyring ./snap.secring --keyring ./snap.pubring \ --output .asc \ --detach-sig ``` #####Verify the image using gpg ``` > gpg --no-default-keyring \ ---secret-keyring ./pulse.secring --keyring ./pulse.pubring \ +--secret-keyring ./snap.secring --keyring ./snap.pubring \ --verify .asc ``` ``` @@ -284,7 +284,7 @@ Name-Real: Tiffany Jernigan Name-Comment: Main signing key Name-Email: my.email@intel.com Expire-Date: 0 -Passphrase: pulse +Passphrase: snap %commit %echo done ``` @@ -314,7 +314,7 @@ sub 2048R/2ED40FB2 2015-08-22 ###Keyring ####Adding to your keyring -If you only have one key, you can use the `pulse.pubring` you just made as your ``. For multiple you can just separate them by a colon. If you want to add future pubkeys.gpg files to an existing keyring you can do +If you only have one key, you can use the `snap.pubring` you just made as your ``. For multiple you can just separate them by a colon. If you want to add future pubkeys.gpg files to an existing keyring you can do ``` > gpg --no-default-keyring --keyring --import pubkeys.gpg ``` diff --git a/pkg/psigning/psigning_test.go b/pkg/psigning/psigning_test.go index 2c6d92489..6832c74cd 100644 --- a/pkg/psigning/psigning_test.go +++ b/pkg/psigning/psigning_test.go @@ -30,10 +30,10 @@ import ( func TestValidateSignature(t *testing.T) { keyringFile := []string{"pubring.gpg"} - signedFile := "pulse-collector-mock1" + signedFile := "snap-collector-mock1" signatureFile := signedFile + ".asc" - pulsePath := os.Getenv("PULSE_PATH") - unsignedFile := path.Join(pulsePath, "plugin", "pulse-collector-mock2") + snapPath := os.Getenv("SNAP_PATH") + unsignedFile := path.Join(snapPath, "plugin", "snap-collector-mock2") s := SigningManager{} signature, _ := ioutil.ReadFile(signatureFile) diff --git a/pkg/psigning/pulse-collector-mock1 b/pkg/psigning/snap-collector-mock1 similarity index 100% rename from pkg/psigning/pulse-collector-mock1 rename to pkg/psigning/snap-collector-mock1 diff --git a/pkg/psigning/pulse-collector-mock1.asc b/pkg/psigning/snap-collector-mock1.asc similarity index 100% rename from pkg/psigning/pulse-collector-mock1.asc rename to pkg/psigning/snap-collector-mock1.asc diff --git a/plugin/collector/pulse-collector-mock1/README.md b/plugin/collector/snap-collector-mock1/README.md similarity index 95% rename from plugin/collector/pulse-collector-mock1/README.md rename to plugin/collector/snap-collector-mock1/README.md index dac3c028e..4bb7b6389 100644 --- a/plugin/collector/pulse-collector-mock1/README.md +++ b/plugin/collector/snap-collector-mock1/README.md @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -## Pulse Collector Plugin Structure +## snap Collector Plugin Structure --- Mock plugins are for testing purposes and not meant as examples. diff --git a/plugin/collector/pulse-collector-mock1/main.go b/plugin/collector/snap-collector-mock1/main.go similarity index 86% rename from plugin/collector/pulse-collector-mock1/main.go rename to plugin/collector/snap-collector-mock1/main.go index 0751f263a..f1d07590c 100644 --- a/plugin/collector/pulse-collector-mock1/main.go +++ b/plugin/collector/snap-collector-mock1/main.go @@ -23,10 +23,10 @@ import ( "os" "time" - // Import the pulse plugin library - "github.com/intelsdi-x/pulse/control/plugin" + // Import the snap plugin library + "github.com/intelsdi-x/snap/control/plugin" // Import our collector plugin implementation - "github.com/intelsdi-x/pulse/plugin/collector/pulse-collector-mock1/mock" + "github.com/intelsdi-x/snap/plugin/collector/snap-collector-mock1/mock" ) func main() { diff --git a/plugin/collector/pulse-collector-mock1/main_test.go b/plugin/collector/snap-collector-mock1/main_test.go similarity index 77% rename from plugin/collector/pulse-collector-mock1/main_test.go rename to plugin/collector/snap-collector-mock1/main_test.go index 0116457bf..c0db1b53d 100644 --- a/plugin/collector/pulse-collector-mock1/main_test.go +++ b/plugin/collector/snap-collector-mock1/main_test.go @@ -25,24 +25,24 @@ import ( "path" "testing" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/plugin/helper" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/plugin/helper" . "github.com/smartystreets/goconvey/convey" ) var ( - PluginName = "pulse-collector-mock1" + PluginName = "snap-collector-mock1" PluginType = "collector" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) ) func TestMockPluginLoad(t *testing.T) { - // These tests only work if PULSE_PATH is known. + // These tests only work if SNAP_PATH is known. // It is the responsibility of the testing framework to // build the plugins first into the build dir. - if PulsePath != "" { + if SnapPath != "" { // Helper plugin trigger build if possible for this plugin helper.BuildPlugin(PluginType, PluginName) // @@ -55,7 +55,7 @@ func TestMockPluginLoad(t *testing.T) { So(err, ShouldBeNil) }) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } diff --git a/plugin/collector/pulse-collector-mock1/mock/mock.go b/plugin/collector/snap-collector-mock1/mock/mock.go similarity index 93% rename from plugin/collector/pulse-collector-mock1/mock/mock.go rename to plugin/collector/snap-collector-mock1/mock/mock.go index c5ec9dcd8..fd91318e6 100644 --- a/plugin/collector/pulse-collector-mock1/mock/mock.go +++ b/plugin/collector/snap-collector-mock1/mock/mock.go @@ -25,10 +25,10 @@ import ( "os" "time" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/ctypes" ) const ( @@ -117,7 +117,7 @@ func (f *Mock) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) { //Meta returns meta data for testing func Meta() *plugin.PluginMeta { - return plugin.NewPluginMeta(Name, Version, Type, []string{plugin.PulseGOBContentType}, []string{plugin.PulseGOBContentType}, plugin.Unsecure(true)) + return plugin.NewPluginMeta(Name, Version, Type, []string{plugin.SnapGOBContentType}, []string{plugin.SnapGOBContentType}, plugin.Unsecure(true)) } //Random number generator diff --git a/plugin/collector/pulse-collector-mock2/README.md b/plugin/collector/snap-collector-mock2/README.md similarity index 93% rename from plugin/collector/pulse-collector-mock2/README.md rename to plugin/collector/snap-collector-mock2/README.md index f14bc5062..46d979057 100644 --- a/plugin/collector/pulse-collector-mock2/README.md +++ b/plugin/collector/snap-collector-mock2/README.md @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -## Pulse Collector Plugin Structure +## snap Collector Plugin Structure --- Mock plugins are for testing purposes and not meant as examples. @@ -36,7 +36,7 @@ If calling a GO based plugin you will want to ensure that the plugin is started You can start a plugin manually for testing by increasing the ping timeout duration. The timeout will be reset each time you call into the plugin. ``` -./pulse-collector-mock2 '{"NoDaemon": false, "PingTimeoutDuration": 1000000000000}' +./snap-collector-mock2 '{"NoDaemon": false, "PingTimeoutDuration": 1000000000000}' ``` ###### GetConfigPolicy diff --git a/plugin/collector/pulse-collector-mock2/main.go b/plugin/collector/snap-collector-mock2/main.go similarity index 86% rename from plugin/collector/pulse-collector-mock2/main.go rename to plugin/collector/snap-collector-mock2/main.go index 82cfbe7e6..6f6e375f5 100644 --- a/plugin/collector/pulse-collector-mock2/main.go +++ b/plugin/collector/snap-collector-mock2/main.go @@ -22,10 +22,10 @@ package main import ( "os" - // Import the pulse plugin library - "github.com/intelsdi-x/pulse/control/plugin" + // Import the snap plugin library + "github.com/intelsdi-x/snap/control/plugin" // Import our collector plugin implementation - "github.com/intelsdi-x/pulse/plugin/collector/pulse-collector-mock2/mock" + "github.com/intelsdi-x/snap/plugin/collector/snap-collector-mock2/mock" ) func main() { diff --git a/plugin/collector/pulse-collector-mock2/main_test.go b/plugin/collector/snap-collector-mock2/main_test.go similarity index 77% rename from plugin/collector/pulse-collector-mock2/main_test.go rename to plugin/collector/snap-collector-mock2/main_test.go index 8261ffd00..ab1da4012 100644 --- a/plugin/collector/pulse-collector-mock2/main_test.go +++ b/plugin/collector/snap-collector-mock2/main_test.go @@ -25,24 +25,24 @@ import ( "path" "testing" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/plugin/helper" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/plugin/helper" . "github.com/smartystreets/goconvey/convey" ) var ( - PluginName = "pulse-collector-mock2" + PluginName = "snap-collector-mock2" PluginType = "collector" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) ) func TestMockPluginLoad(t *testing.T) { - // These tests only work if PULSE_PATH is known. + // These tests only work if SNAP_PATH is known. // It is the responsibility of the testing framework to // build the plugins first into the build dir. - if PulsePath != "" { + if SnapPath != "" { // Helper plugin trigger build if possible for this plugin helper.BuildPlugin(PluginType, PluginName) // @@ -55,7 +55,7 @@ func TestMockPluginLoad(t *testing.T) { So(err, ShouldBeNil) }) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } diff --git a/plugin/collector/pulse-collector-mock2/mock/mock.go b/plugin/collector/snap-collector-mock2/mock/mock.go similarity index 94% rename from plugin/collector/pulse-collector-mock2/mock/mock.go rename to plugin/collector/snap-collector-mock2/mock/mock.go index 00b0d71a6..525655ba7 100644 --- a/plugin/collector/pulse-collector-mock2/mock/mock.go +++ b/plugin/collector/snap-collector-mock2/mock/mock.go @@ -26,9 +26,9 @@ import ( "os" "time" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core" ) const ( @@ -110,7 +110,7 @@ func (f *Mock) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) { //Meta returns meta data for testing func Meta() *plugin.PluginMeta { - return plugin.NewPluginMeta(Name, Version, Type, []string{plugin.PulseGOBContentType}, []string{plugin.PulseGOBContentType}) + return plugin.NewPluginMeta(Name, Version, Type, []string{plugin.SnapGOBContentType}, []string{plugin.SnapGOBContentType}) } //Random number generator diff --git a/plugin/processor/pulse-processor-passthru/main.go b/plugin/processor/snap-processor-passthru/main.go similarity index 85% rename from plugin/processor/pulse-processor-passthru/main.go rename to plugin/processor/snap-processor-passthru/main.go index ff913c8d3..8f9daf412 100644 --- a/plugin/processor/pulse-processor-passthru/main.go +++ b/plugin/processor/snap-processor-passthru/main.go @@ -22,8 +22,8 @@ package main import ( "os" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/plugin/processor/pulse-processor-passthru/passthru" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/plugin/processor/snap-processor-passthru/passthru" ) func main() { diff --git a/plugin/processor/pulse-processor-passthru/passthru/passthru.go b/plugin/processor/snap-processor-passthru/passthru/passthru.go similarity index 90% rename from plugin/processor/pulse-processor-passthru/passthru/passthru.go rename to plugin/processor/snap-processor-passthru/passthru/passthru.go index 1853ef70d..bd3836285 100644 --- a/plugin/processor/pulse-processor-passthru/passthru/passthru.go +++ b/plugin/processor/snap-processor-passthru/passthru/passthru.go @@ -25,9 +25,9 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core/ctypes" ) const ( @@ -38,7 +38,7 @@ const ( // Meta returns a plugin meta data func Meta() *plugin.PluginMeta { - return plugin.NewPluginMeta(name, version, pluginType, []string{plugin.PulseGOBContentType}, []string{plugin.PulseGOBContentType}) + return plugin.NewPluginMeta(name, version, pluginType, []string{plugin.SnapGOBContentType}, []string{plugin.SnapGOBContentType}) } func NewPassthruPublisher() *passthruProcessor { diff --git a/plugin/publisher/pulse-publisher-file/README.md b/plugin/publisher/snap-publisher-file/README.md similarity index 100% rename from plugin/publisher/pulse-publisher-file/README.md rename to plugin/publisher/snap-publisher-file/README.md diff --git a/plugin/publisher/pulse-publisher-file/file/file.go b/plugin/publisher/snap-publisher-file/file/file.go similarity index 91% rename from plugin/publisher/pulse-publisher-file/file/file.go rename to plugin/publisher/snap-publisher-file/file/file.go index 91366161a..58a936559 100644 --- a/plugin/publisher/pulse-publisher-file/file/file.go +++ b/plugin/publisher/snap-publisher-file/file/file.go @@ -29,9 +29,9 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/control/plugin/cpolicy" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/control/plugin/cpolicy" + "github.com/intelsdi-x/snap/core/ctypes" ) const ( @@ -53,7 +53,7 @@ func (f *filePublisher) Publish(contentType string, content []byte, config map[s var metrics []plugin.PluginMetricType switch contentType { - case plugin.PulseGOBContentType: + case plugin.SnapGOBContentType: dec := gob.NewDecoder(bytes.NewBuffer(content)) if err := dec.Decode(&metrics); err != nil { logger.Printf("Error decoding: error=%v content=%v", err, content) @@ -85,7 +85,7 @@ func (f *filePublisher) Publish(contentType string, content []byte, config map[s } func Meta() *plugin.PluginMeta { - return plugin.NewPluginMeta(name, version, pluginType, []string{plugin.PulseGOBContentType}, []string{plugin.PulseGOBContentType}) + return plugin.NewPluginMeta(name, version, pluginType, []string{plugin.SnapGOBContentType}, []string{plugin.SnapGOBContentType}) } func (f *filePublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) { diff --git a/plugin/publisher/pulse-publisher-file/file/file_test.go b/plugin/publisher/snap-publisher-file/file/file_test.go similarity index 90% rename from plugin/publisher/pulse-publisher-file/file/file_test.go rename to plugin/publisher/snap-publisher-file/file/file_test.go index 6482261e8..7cebbcd1d 100644 --- a/plugin/publisher/pulse-publisher-file/file/file_test.go +++ b/plugin/publisher/snap-publisher-file/file/file_test.go @@ -27,8 +27,8 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core/ctypes" . "github.com/smartystreets/goconvey/convey" ) @@ -48,7 +48,7 @@ func TestFilePublish(t *testing.T) { So(fp, ShouldNotBeNil) err := fp.Publish("", buf.Bytes(), config) So(err, ShouldResemble, errors.New("Unknown content type ''")) - err = fp.Publish(plugin.PulseGOBContentType, buf.Bytes(), config) + err = fp.Publish(plugin.SnapGOBContentType, buf.Bytes(), config) So(err, ShouldBeNil) _, err = os.Stat(config["file"].(ctypes.ConfigValueStr).Value) So(err, ShouldBeNil) diff --git a/plugin/publisher/pulse-publisher-file/main.go b/plugin/publisher/snap-publisher-file/main.go similarity index 86% rename from plugin/publisher/pulse-publisher-file/main.go rename to plugin/publisher/snap-publisher-file/main.go index ab5db5d36..b24b80e4b 100644 --- a/plugin/publisher/pulse-publisher-file/main.go +++ b/plugin/publisher/snap-publisher-file/main.go @@ -22,8 +22,8 @@ package main import ( "os" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/plugin/publisher/pulse-publisher-file/file" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/plugin/publisher/snap-publisher-file/file" ) func main() { diff --git a/plugin/publisher/pulse-publisher-file/main_test.go b/plugin/publisher/snap-publisher-file/main_test.go similarity index 78% rename from plugin/publisher/pulse-publisher-file/main_test.go rename to plugin/publisher/snap-publisher-file/main_test.go index 74aa5d290..f98a59ae0 100644 --- a/plugin/publisher/pulse-publisher-file/main_test.go +++ b/plugin/publisher/snap-publisher-file/main_test.go @@ -25,24 +25,24 @@ import ( "path" "testing" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/plugin/helper" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/plugin/helper" . "github.com/smartystreets/goconvey/convey" ) var ( - PluginName = "pulse-publisher-file" + PluginName = "snap-publisher-file" PluginType = "publisher" - PulsePath = os.Getenv("PULSE_PATH") - PluginPath = path.Join(PulsePath, "plugin", PluginName) + SnapPath = os.Getenv("SNAP_PATH") + PluginPath = path.Join(SnapPath, "plugin", PluginName) ) func TestFilePublisherLoad(t *testing.T) { - // These tests only work if PULSE_PATH is known. + // These tests only work if SNAP_PATH is known. // It is the responsibility of the testing framework to // build the plugins first into the build dir. - if PulsePath != "" { + if SnapPath != "" { // Helper plugin trigger build if possible for this plugin helper.BuildPlugin(PluginType, PluginName) // @@ -56,7 +56,7 @@ func TestFilePublisherLoad(t *testing.T) { So(err, ShouldBeNil) }) } else { - fmt.Printf("PULSE_PATH not set. Cannot test %s plugin.\n", PluginName) + fmt.Printf("SNAP_PATH not set. Cannot test %s plugin.\n", PluginName) } } diff --git a/scheduler/job.go b/scheduler/job.go index 661e43998..ad6b8b962 100644 --- a/scheduler/job.go +++ b/scheduler/job.go @@ -27,10 +27,10 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" ) const ( @@ -223,7 +223,7 @@ func (p *processJob) Run() { switch p.parentJob.Type() { case collectJobType: switch p.contentType { - case plugin.PulseGOBContentType: + case plugin.SnapGOBContentType: metrics := make([]plugin.PluginMetricType, len(p.parentJob.(*collectorJob).metrics)) for i, m := range p.parentJob.(*collectorJob).metrics { switch mt := m.(type) { @@ -318,7 +318,7 @@ func (p *publisherJob) Run() { switch p.parentJob.Type() { case collectJobType: switch p.contentType { - case plugin.PulseGOBContentType: + case plugin.SnapGOBContentType: metrics := make([]plugin.PluginMetricType, len(p.parentJob.(*collectorJob).metrics)) for i, m := range p.parentJob.(*collectorJob).metrics { switch mt := m.(type) { @@ -359,7 +359,7 @@ func (p *publisherJob) Run() { } case processJobType: switch p.contentType { - case plugin.PulseGOBContentType: + case plugin.SnapGOBContentType: errs := p.publisher.PublishMetrics(p.contentType, p.parentJob.(*processJob).content, p.pluginName, p.pluginVersion, p.config) if errs != nil { for _, e := range errs { diff --git a/scheduler/job_test.go b/scheduler/job_test.go index 2721a16aa..19daee442 100644 --- a/scheduler/job_test.go +++ b/scheduler/job_test.go @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 7e66514ca..e66524c65 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -28,12 +28,12 @@ import ( log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/core/scheduler_event" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/core/scheduler_event" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) var ( @@ -59,9 +59,9 @@ type managesMetrics interface { publishesMetrics processesMetrics managesPluginContentTypes - ValidateDeps([]core.Metric, []core.SubscribedPlugin) []perror.PulseError - SubscribeDeps(string, []core.Metric, []core.Plugin) []perror.PulseError - UnsubscribeDeps(string, []core.Metric, []core.Plugin) []perror.PulseError + ValidateDeps([]core.Metric, []core.SubscribedPlugin) []perror.SnapError + SubscribeDeps(string, []core.Metric, []core.Plugin) []perror.SnapError + UnsubscribeDeps(string, []core.Metric, []core.Plugin) []perror.SnapError } // ManagesPluginContentTypes is an interface to a plugin manager that can tell us what content accept and returns are supported. @@ -118,10 +118,10 @@ func New(opts ...workManagerOption) *scheduler { } type taskErrors struct { - errs []perror.PulseError + errs []perror.SnapError } -func (t *taskErrors) Errors() []perror.PulseError { +func (t *taskErrors) Errors() []perror.SnapError { return t.errs } @@ -149,7 +149,7 @@ func (s *scheduler) createTask(sch schedule.Schedule, wfMap *wmap.WorkflowMap, s }) // Create a container for task errors te := &taskErrors{ - errs: make([]perror.PulseError, 0), + errs: make([]perror.SnapError, 0), } // Return error if we are not started. @@ -280,15 +280,15 @@ func (s *scheduler) GetTask(id string) (core.Task, error) { } // StartTask provided a task id a task is started -func (s *scheduler) StartTask(id string) []perror.PulseError { +func (s *scheduler) StartTask(id string) []perror.SnapError { return s.startTask(id, "user") } -func (s *scheduler) StartTaskTribe(id string) []perror.PulseError { +func (s *scheduler) StartTaskTribe(id string) []perror.SnapError { return s.startTask(id, "tribe") } -func (s *scheduler) startTask(id, source string) []perror.PulseError { +func (s *scheduler) startTask(id, source string) []perror.SnapError { logger := s.logger.WithFields(log.Fields{ "_block": "start-task", "source": source, @@ -300,7 +300,7 @@ func (s *scheduler) startTask(id, source string) []perror.PulseError { "_error": ErrTaskNotFound, "task-id": id, }).Error("error starting task") - return []perror.PulseError{ + return []perror.SnapError{ perror.New(err), } } @@ -310,7 +310,7 @@ func (s *scheduler) startTask(id, source string) []perror.PulseError { "task-id": t.ID(), "task-state": t.State(), }).Info("task is already running") - return []perror.PulseError{ + return []perror.SnapError{ perror.New(ErrTaskAlreadyRunning), } } @@ -336,15 +336,15 @@ func (s *scheduler) startTask(id, source string) []perror.PulseError { } // StopTask provided a task id a task is stopped -func (s *scheduler) StopTask(id string) []perror.PulseError { +func (s *scheduler) StopTask(id string) []perror.SnapError { return s.stopTask(id, "user") } -func (s *scheduler) StopTaskTribe(id string) []perror.PulseError { +func (s *scheduler) StopTaskTribe(id string) []perror.SnapError { return s.stopTask(id, "tribe") } -func (s *scheduler) stopTask(id, source string) []perror.PulseError { +func (s *scheduler) stopTask(id, source string) []perror.SnapError { logger := s.logger.WithFields(log.Fields{ "_block": "stop-task", "source": source, @@ -355,7 +355,7 @@ func (s *scheduler) stopTask(id, source string) []perror.PulseError { "_error": err.Error(), "task-id": id, }).Error("error stopping task") - return []perror.PulseError{ + return []perror.SnapError{ perror.New(err), } } @@ -365,7 +365,7 @@ func (s *scheduler) stopTask(id, source string) []perror.PulseError { "task-id": t.ID(), "task-state": t.State(), }).Info("task is already stopped") - return []perror.PulseError{ + return []perror.SnapError{ perror.New(ErrTaskAlreadyStopped), } } @@ -573,7 +573,7 @@ func returnCorePlugin(plugins []core.SubscribedPlugin) []core.Plugin { return cps } -func buildErrorsLog(errs []perror.PulseError, logger *log.Entry) *log.Entry { +func buildErrorsLog(errs []perror.SnapError, logger *log.Entry) *log.Entry { for i, e := range errs { logger = logger.WithField(fmt.Sprintf("%s[%d]", "error", i), e.Error()) } diff --git a/scheduler/scheduler_test.go b/scheduler/scheduler_test.go index f2d3f84cc..641a421b1 100644 --- a/scheduler/scheduler_test.go +++ b/scheduler/scheduler_test.go @@ -28,12 +28,12 @@ import ( log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) type mockMetricManager struct { @@ -91,21 +91,21 @@ func (m *mockMetricManager) ProcessMetrics(contentType string, content []byte, p return "", nil, nil } -func (m *mockMetricManager) ValidateDeps(mts []core.Metric, prs []core.SubscribedPlugin) []perror.PulseError { +func (m *mockMetricManager) ValidateDeps(mts []core.Metric, prs []core.SubscribedPlugin) []perror.SnapError { if m.failValidatingMetrics { - return []perror.PulseError{ + return []perror.SnapError{ perror.New(errors.New("metric validation error")), } } return nil } -func (m *mockMetricManager) SubscribeDeps(taskId string, mts []core.Metric, prs []core.Plugin) []perror.PulseError { - return []perror.PulseError{ +func (m *mockMetricManager) SubscribeDeps(taskId string, mts []core.Metric, prs []core.Plugin) []perror.SnapError { + return []perror.SnapError{ perror.New(errors.New("metric validation error")), } } -func (m *mockMetricManager) UnsubscribeDeps(taskId string, mts []core.Metric, prs []core.Plugin) []perror.PulseError { +func (m *mockMetricManager) UnsubscribeDeps(taskId string, mts []core.Metric, prs []core.Plugin) []perror.SnapError { return nil } @@ -159,10 +159,10 @@ func TestScheduler(t *testing.T) { log.SetLevel(log.FatalLevel) Convey("NewTask", t, func() { c := new(mockMetricManager) - c.setAcceptedContentType("machine", core.ProcessorPluginType, 1, []string{"pulse.*", "pulse.gob", "foo.bar"}) - c.setReturnedContentType("machine", core.ProcessorPluginType, 1, []string{"pulse.gob"}) - c.setAcceptedContentType("rmq", core.PublisherPluginType, -1, []string{"pulse.json", "pulse.gob"}) - c.setAcceptedContentType("file", core.PublisherPluginType, -1, []string{"pulse.json"}) + c.setAcceptedContentType("machine", core.ProcessorPluginType, 1, []string{"snap.*", "snap.gob", "foo.bar"}) + c.setReturnedContentType("machine", core.ProcessorPluginType, 1, []string{"snap.gob"}) + c.setAcceptedContentType("rmq", core.PublisherPluginType, -1, []string{"snap.json", "snap.gob"}) + c.setAcceptedContentType("file", core.PublisherPluginType, -1, []string{"snap.json"}) s := New() s.SetMetricManager(c) w := wmap.NewWorkflowMap() @@ -210,7 +210,7 @@ func TestScheduler(t *testing.T) { for _, i := range t.(*task).workflow.publishNodes { testInboundContentType(i) } - So(t.(*task).workflow.processNodes[0].ProcessNodes[0].PublishNodes[0].InboundContentType, ShouldEqual, "pulse.json") + So(t.(*task).workflow.processNodes[0].ProcessNodes[0].PublishNodes[0].InboundContentType, ShouldEqual, "snap.json") Convey("returns errors when metrics do not validate", func() { c.failValidatingMetrics = true diff --git a/scheduler/task.go b/scheduler/task.go index eefd0a99a..3012bd25c 100644 --- a/scheduler/task.go +++ b/scheduler/task.go @@ -29,10 +29,10 @@ import ( "github.com/intelsdi-x/gomit" "github.com/pborman/uuid" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/scheduler_event" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/scheduler_event" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" ) const ( diff --git a/scheduler/task_test.go b/scheduler/task_test.go index c1a447b6d..ae14cb5c3 100644 --- a/scheduler/task_test.go +++ b/scheduler/task_test.go @@ -23,10 +23,10 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" log "github.com/Sirupsen/logrus" "github.com/intelsdi-x/gomit" @@ -44,7 +44,7 @@ func TestTask(t *testing.T) { wf, errs := wmapToWorkflow(sampleWFMap) So(errs, ShouldBeEmpty) c := &mockMetricManager{} - c.setAcceptedContentType("rabbitmq", core.PublisherPluginType, 5, []string{plugin.PulseGOBContentType}) + c.setAcceptedContentType("rabbitmq", core.PublisherPluginType, 5, []string{plugin.SnapGOBContentType}) err := wf.BindPluginContentTypes(c) So(err, ShouldBeNil) Convey("task + simple schedule", func() { diff --git a/scheduler/watcher.go b/scheduler/watcher.go index 58ff091fe..a9519f1e9 100644 --- a/scheduler/watcher.go +++ b/scheduler/watcher.go @@ -24,7 +24,7 @@ import ( log "github.com/Sirupsen/logrus" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" ) var ( diff --git a/scheduler/watcher_test.go b/scheduler/watcher_test.go index d4a0f3323..c05b6c458 100644 --- a/scheduler/watcher_test.go +++ b/scheduler/watcher_test.go @@ -22,7 +22,7 @@ package scheduler import ( "testing" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" diff --git a/scheduler/wmap/wmap.go b/scheduler/wmap/wmap.go index 2c41d316f..3c37b75b6 100644 --- a/scheduler/wmap/wmap.go +++ b/scheduler/wmap/wmap.go @@ -26,8 +26,8 @@ import ( "regexp" "strings" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/ctypes" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/ctypes" "gopkg.in/yaml.v2" ) diff --git a/scheduler/workflow.go b/scheduler/workflow.go index e9f444ce7..58295b24e 100644 --- a/scheduler/workflow.go +++ b/scheduler/workflow.go @@ -25,11 +25,11 @@ import ( "github.com/intelsdi-x/gomit" - "github.com/intelsdi-x/pulse/control/plugin" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/core/scheduler_event" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/control/plugin" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/core/scheduler_event" + "github.com/intelsdi-x/snap/scheduler/wmap" ) type WorkflowState int @@ -224,7 +224,7 @@ type wfContentTypes map[string]map[string][]string // BindPluginContentTypes func (s *schedulerWorkflow) BindPluginContentTypes(mm managesPluginContentTypes) error { - bindPluginContentTypes(s.publishNodes, s.processNodes, mm, []string{plugin.PulseGOBContentType}) + bindPluginContentTypes(s.publishNodes, s.processNodes, mm, []string{plugin.SnapGOBContentType}) return nil } @@ -245,22 +245,22 @@ func bindPluginContentTypes(pus []*publishNode, prs []*processNode, mm managesPl } } } - // if the inbound content type isn't set yet pulse may be able to do + // if the inbound content type isn't set yet snap may be able to do // the conversion if pr.InboundContentType == "" { for _, ac := range act { switch ac { - case plugin.PulseGOBContentType: - pr.InboundContentType = plugin.PulseGOBContentType - case plugin.PulseJSONContentType: - pr.InboundContentType = plugin.PulseJSONContentType - case plugin.PulseAllContentType: - pr.InboundContentType = plugin.PulseGOBContentType + case plugin.SnapGOBContentType: + pr.InboundContentType = plugin.SnapGOBContentType + case plugin.SnapJSONContentType: + pr.InboundContentType = plugin.SnapJSONContentType + case plugin.SnapAllContentType: + pr.InboundContentType = plugin.SnapGOBContentType } } // else we return an error if pr.InboundContentType == "" { - return fmt.Errorf("Invalid workflow. Plugin '%s' does not accept the pulse content types or the types '%v' returned from the previous node.", pr.Name(), lct) + return fmt.Errorf("Invalid workflow. Plugin '%s' does not accept the snap content types or the types '%v' returned from the previous node.", pr.Name(), lct) } } //continue the walk down the nodes @@ -271,22 +271,22 @@ func bindPluginContentTypes(pus []*publishNode, prs []*processNode, mm managesPl if err != nil { return err } - // if the inbound content type isn't set yet pulse may be able to do + // if the inbound content type isn't set yet snap may be able to do // the conversion if pu.InboundContentType == "" { for _, ac := range act { switch ac { - case plugin.PulseGOBContentType: - pu.InboundContentType = plugin.PulseGOBContentType - case plugin.PulseJSONContentType: - pu.InboundContentType = plugin.PulseJSONContentType - case plugin.PulseAllContentType: - pu.InboundContentType = plugin.PulseGOBContentType + case plugin.SnapGOBContentType: + pu.InboundContentType = plugin.SnapGOBContentType + case plugin.SnapJSONContentType: + pu.InboundContentType = plugin.SnapJSONContentType + case plugin.SnapAllContentType: + pu.InboundContentType = plugin.SnapGOBContentType } } // else we return an error if pu.InboundContentType == "" { - return fmt.Errorf("Invalid workflow. Plugin '%s' does not accept the pulse content types or the types '%v' returned from the previous node.", pu.Name(), lct) + return fmt.Errorf("Invalid workflow. Plugin '%s' does not accept the snap content types or the types '%v' returned from the previous node.", pu.Name(), lct) } } } diff --git a/scheduler/workflow_string.go b/scheduler/workflow_string.go index cfec87df9..56bdbc957 100644 --- a/scheduler/workflow_string.go +++ b/scheduler/workflow_string.go @@ -23,7 +23,7 @@ import ( "fmt" "strings" - "github.com/intelsdi-x/pulse/core" + "github.com/intelsdi-x/snap/core" ) func (s *schedulerWorkflow) String() string { diff --git a/scheduler/workflow_string_test.go b/scheduler/workflow_string_test.go index 5ded7f161..f341af8ef 100644 --- a/scheduler/workflow_string_test.go +++ b/scheduler/workflow_string_test.go @@ -22,7 +22,7 @@ package scheduler import ( "testing" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/scheduler/wmap" log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" diff --git a/scheduler/workflow_test.go b/scheduler/workflow_test.go index 6fe4ea353..a34f25a4f 100644 --- a/scheduler/workflow_test.go +++ b/scheduler/workflow_test.go @@ -25,18 +25,18 @@ import ( "testing" "time" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/cdata" - "github.com/intelsdi-x/pulse/pkg/schedule" - "github.com/intelsdi-x/pulse/scheduler/wmap" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/cdata" + "github.com/intelsdi-x/snap/pkg/schedule" + "github.com/intelsdi-x/snap/scheduler/wmap" log "github.com/Sirupsen/logrus" . "github.com/smartystreets/goconvey/convey" ) var ( - PulsePath = os.Getenv("PULSE_PATH") + SnapPath = os.Getenv("SNAP_PATH") ) type MockMetricType struct { @@ -72,13 +72,13 @@ func TestCollectPublishWorkflow(t *testing.T) { s := New() s.SetMetricManager(c) Convey("create a workflow", func() { - rp, _ := core.NewRequestedPlugin(path.Join(PulsePath, "plugin", "pulse-collector-mock2")) + rp, _ := core.NewRequestedPlugin(path.Join(SnapPath, "plugin", "snap-collector-mock2")) _, err := c.Load(rp) So(err, ShouldBeNil) - rp2, _ := core.NewRequestedPlugin(path.Join(PulsePath, "plugin", "pulse-publisher-file")) + rp2, _ := core.NewRequestedPlugin(path.Join(SnapPath, "plugin", "snap-publisher-file")) _, err = c.Load(rp2) So(err, ShouldBeNil) - rp3, _ := core.NewRequestedPlugin(path.Join(PulsePath, "plugin", "pulse-processor-passthru")) + rp3, _ := core.NewRequestedPlugin(path.Join(SnapPath, "plugin", "snap-processor-passthru")) _, err = c.Load(rp3) So(err, ShouldBeNil) time.Sleep(100 * time.Millisecond) @@ -92,7 +92,7 @@ func TestCollectPublishWorkflow(t *testing.T) { w.CollectNode.AddConfigItem("/intel/mock/foo", "password", "secret") pu := wmap.NewPublishNode("file", 3) - pu.AddConfigItem("file", "/tmp/pulse-TestCollectPublishWorkflow.out") + pu.AddConfigItem("file", "/tmp/snap-TestCollectPublishWorkflow.out") pr := wmap.NewProcessNode("passthru", 1) time.Sleep(100 * time.Millisecond) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 25ba0b746..5d68af35f 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,12 +1,12 @@ FROM golang:latest ENV GOPATH=$GOPATH:/app -ENV PULSE_PATH=/go/src/github.com/intelsdi-x/pulse/build +ENV SNAP_PATH=/go/src/github.com/intelsdi-x/snap/build RUN apt-get update && \ apt-get -y install facter WORKDIR /go/src/github.com/intelsdi-x/ RUN git clone https://@github.com/intelsdi-x/gomit.git -WORKDIR /go/src/github.com/intelsdi-x/pulse -ADD . /go/src/github.com/intelsdi-x/pulse +WORKDIR /go/src/github.com/intelsdi-x/snap +ADD . /go/src/github.com/intelsdi-x/snap RUN go get github.com/tools/godep && \ go get golang.org/x/tools/cmd/goimports && \ go get golang.org/x/tools/cmd/vet && \ diff --git a/scripts/build-plugin.sh b/scripts/build-plugin.sh index 2069d3ae2..4a76f607f 100755 --- a/scripts/build-plugin.sh +++ b/scripts/build-plugin.sh @@ -20,7 +20,7 @@ BUILDCMD='go build -a -ldflags "-w"' BUILDDIR=$1 PLUGIN=$2 -PLUGINNAME=`echo $PLUGIN | grep -oh "pulse-.*"` +PLUGINNAME=`echo $PLUGIN | grep -oh "snap-.*"` echo " $PLUGINNAME => $BUILDDIR" $BUILDCMD -o $BUILDDIR/$PLUGINNAME $PLUGIN || exit 2 diff --git a/scripts/build.sh b/scripts/build.sh index 9f036ba96..52fe3b532 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -31,7 +31,7 @@ PROCESSORDIR=$BUILDDIR/$PLUGINDIR/processor BUILDCMD='go build -a -ldflags "-w"' echo -echo "**** Pulse Build ($GITVERSION) ****" +echo "**** snap Build ($GITVERSION) ****" echo # Disable CGO for builds...unless Linux...because appc @@ -50,13 +50,13 @@ mkdir -p $COLLECTORDIR mkdir -p $PUBLISHERDIR mkdir -p $PROCESSORDIR -# pulsed +# snapd echo "Source Dir = $SOURCEDIR" -echo " Building Pulse Daemon" -go build -ldflags "-w -X main.gitversion=$GITVERSION" -o $BINDIR/pulsed . || exit 1 +echo " Building snap Daemon" +go build -ldflags "-w -X main.gitversion=$GITVERSION" -o $BINDIR/snapd . || exit 1 -# pulsectl -echo " Building Pulse Command Line" +# snapctl +echo " Building snap Command Line" cd $SOURCEDIR/cmd for d in *; do if [[ -d $d ]]; then @@ -82,7 +82,7 @@ if [ "$BUILDPLUGINS" == "true" ]; then rm -rf $BUILDDIR/$PLUGINDIR/* cd $SOURCEDIR echo " Building Plugin(s)" - find ./plugin/* -iname "pulse-*" -print0 | xargs -0 -P 4 -n 1 $SOURCEDIR/scripts/build-plugin.sh $BUILDDIR/$PLUGINDIR/ || exit 2 + find ./plugin/* -iname "snap-*" -print0 | xargs -0 -P 4 -n 1 $SOURCEDIR/scripts/build-plugin.sh $BUILDDIR/$PLUGINDIR/ || exit 2 cd $SOURCEDIR fi diff --git a/scripts/deps.sh b/scripts/deps.sh index 3db6f88d7..a4ccfd33b 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -17,23 +17,23 @@ #See the License for the specific language governing permissions and #limitations under the License. -# This script runs the correct godep sequences for pulse and built-in plugins -# This will rebase back to the committed version. It should be run from pulse/. +# This script runs the correct godep sequences for snap and built-in plugins +# This will rebase back to the committed version. It should be run from snap/. ctrl_c() { exit $? } trap ctrl_c SIGINT -# First load pulse deps -echo "Checking pulse root for deps" +# First load snap deps +echo "Checking snap root for deps" godep restore # REST API -echo "Checking pulsectl for deps" -cd cmd/pulsectl +echo "Checking snapctl for deps" +cd cmd/snapctl godep restore # CLI -echo "Checking pulse mgmt/rest for deps" +echo "Checking snap mgmt/rest for deps" cd ../../mgmt/rest godep restore cd ../../ diff --git a/scripts/release.sh b/scripts/release.sh index f25db3615..8f0adb32f 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -21,10 +21,10 @@ export PATH=$PATH:$GOPATH/bin USER="intelsdi-x" -REPO="pulse" +REPO="snap" # Set GITVERSION that will be used in release. If tag specified during make release call, -# then use that version and tag the repo so pulse version corresponds to tag. +# then use that version and tag the repo so snap version corresponds to tag. if [ -n "$1" ]; then GITVERSION=$1 else @@ -47,31 +47,31 @@ CHANGELOG=`git log $COMPARISON --oneline --no-merges --reverse` git fetch -t --all git checkout $GITVERSION -# Build Pulse for each OS and arch specified. +# Build snap for each OS and arch specified. # Currently support: # - Darwin (Mac OS X) 64bit # - Linux 64bit for GOOS in darwin linux; do GOARCH=amd64 - echo "Building Pulse ($GITVERSION) for $GOOS-$GOARCH" + echo "Building snap ($GITVERSION) for $GOOS-$GOARCH" export GOOS=$GOOS export GOARCH=$GOARCH make - echo "Preparing Pulse release $GITVERSION-$GOOS-$GOARCH" + echo "Preparing snap release $GITVERSION-$GOOS-$GOARCH" ARCH_DIR=build/release/$GOOS-$GOARCH - RELEASE_DIR=$ARCH_DIR/pulse-$GITVERSION + RELEASE_DIR=$ARCH_DIR/snap-$GITVERSION DIST_DIR=build/release/dist/$GITVERSION mkdir -p $RELEASE_DIR/{bin,plugin} mkdir -p $DIST_DIR cp build/bin/* $RELEASE_DIR/bin cp build/plugin/* $RELEASE_DIR/plugin - tar czf $DIST_DIR/pulse-$GITVERSION-$GOOS-$GOARCH.tar.gz -C $ARCH_DIR pulse-$GITVERSION/bin/ - tar czf $DIST_DIR/pulse-plugins-$GITVERSION-$GOOS-$GOARCH.tar.gz -C $ARCH_DIR pulse-$GITVERSION/plugin/ + tar czf $DIST_DIR/snap-$GITVERSION-$GOOS-$GOARCH.tar.gz -C $ARCH_DIR snap-$GITVERSION/bin/ + tar czf $DIST_DIR/snap-plugins-$GITVERSION-$GOOS-$GOARCH.tar.gz -C $ARCH_DIR snap-$GITVERSION/plugin/ done -echo "Pushing Pulse release $GITVERSION" +echo "Pushing snap release $GITVERSION" github-release release create \ -u $USER \ -r $REPO \ diff --git a/scripts/run_tests_with_docker.sh b/scripts/run_tests_with_docker.sh index f582bb07f..d54e457c9 100755 --- a/scripts/run_tests_with_docker.sh +++ b/scripts/run_tests_with_docker.sh @@ -31,6 +31,6 @@ if [ -z "${GIT_TOKEN}" ]; then fi sed s/\/${GIT_TOKEN}/ scripts/Dockerfile > scripts/Dockerfile.tmp -docker build -t intelsdi-x/pulse-test -f scripts/Dockerfile.tmp . +docker build -t intelsdi-x/snap-test -f scripts/Dockerfile.tmp . rm scripts/Dockerfile.tmp -docker run -it intelsdi-x/pulse-test scripts/test.sh +docker run -it intelsdi-x/snap-test scripts/test.sh diff --git a/scripts/test.sh b/scripts/test.sh index 8aa84b8d5..ce7796137 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -26,7 +26,7 @@ # 6. test coverage (http://blog.golang.org/cover) COVERALLS_TOKEN=t47LG6BQsfLwb9WxB56hXUezvwpED6D11 -TEST_DIRS="cmd/ control/ core/ mgmt/ pkg/ pulse.go scheduler/" +TEST_DIRS="cmd/ control/ core/ mgmt/ pkg/ snapd.go scheduler/" VET_DIRS="./cmd/... ./control/... ./core/... ./mgmt/... ./pkg/... ./scheduler/... ." set -e diff --git a/pulse.go b/snapd.go similarity index 84% rename from pulse.go rename to snapd.go index 72d4a6f54..1d14cf6f9 100644 --- a/pulse.go +++ b/snapd.go @@ -35,13 +35,13 @@ import ( log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" - "github.com/intelsdi-x/pulse/control" - "github.com/intelsdi-x/pulse/core" - "github.com/intelsdi-x/pulse/core/perror" - "github.com/intelsdi-x/pulse/mgmt/rest" - "github.com/intelsdi-x/pulse/mgmt/tribe" - "github.com/intelsdi-x/pulse/mgmt/tribe/agreement" - "github.com/intelsdi-x/pulse/scheduler" + "github.com/intelsdi-x/snap/control" + "github.com/intelsdi-x/snap/core" + "github.com/intelsdi-x/snap/core/perror" + "github.com/intelsdi-x/snap/mgmt/rest" + "github.com/intelsdi-x/snap/mgmt/tribe" + "github.com/intelsdi-x/snap/mgmt/tribe/agreement" + "github.com/intelsdi-x/snap/scheduler" ) var ( @@ -56,7 +56,7 @@ var ( } flMaxProcs = cli.IntFlag{ Name: "max-procs, c", - Usage: "Set max cores to use for Pulse Agent. Default is 1 core.", + Usage: "Set max cores to use for snap Agent. Default is 1 core.", Value: 1, EnvVar: "GOMAXPROCS", } @@ -64,40 +64,40 @@ var ( Name: "max-running-plugins, m", Usage: "The maximum number of instances of a loaded plugin to run", Value: 3, - EnvVar: "PULSE_MAX_PLUGINS", + EnvVar: "SNAP_MAX_PLUGINS", } // plugin flLogPath = cli.StringFlag{ Name: "log-path, o", Usage: "Path for logs. Empty path logs to stdout.", - EnvVar: "PULSE_LOG_PATH", + EnvVar: "SNAP_LOG_PATH", } flLogLevel = cli.IntFlag{ Name: "log-level, l", Usage: "1-5 (Debug, Info, Warning, Error, Fatal)", - EnvVar: "PULSE_LOG_LEVEL", + EnvVar: "SNAP_LOG_LEVEL", Value: 3, } flPluginVersion = cli.StringFlag{ Name: "auto-discover, a", Usage: "Auto discover paths separated by colons.", - EnvVar: "PULSE_AUTOLOAD_PATH", + EnvVar: "SNAP_AUTOLOAD_PATH", } flPluginTrust = cli.IntFlag{ Name: "plugin-trust, t", Usage: "0-2 (Disabled, Enabled, Warning)", - EnvVar: "PULSE_TRUST_LEVEL", + EnvVar: "SNAP_TRUST_LEVEL", Value: 1, } flkeyringPaths = cli.StringFlag{ Name: "keyring-files, k", Usage: "Keyring files for signing verification separated by colons", - EnvVar: "PULSE_KEYRING_FILES", + EnvVar: "SNAP_KEYRING_FILES", } flCache = cli.StringFlag{ Name: "cache-expiration", Usage: "The time limit for which a metric cache entry is valid", - EnvVar: "PULSE_CACHE_EXPIRATION", + EnvVar: "SNAP_CACHE_EXPIRATION", Value: "500ms", } flConfig = cli.StringFlag{ @@ -106,15 +106,15 @@ var ( } flRestHttps = cli.BoolFlag{ Name: "rest-https", - Usage: "start Pulse's API as https", + Usage: "start snap's API as https", } flRestCert = cli.StringFlag{ Name: "rest-cert", - Usage: "A path to a certificate to use for HTTPS deployment of Pulse's REST API", + Usage: "A path to a certificate to use for HTTPS deployment of snap's REST API", } flRestKey = cli.StringFlag{ Name: "rest-key", - Usage: "A path to a key file to use for HTTPS deployment of Pulse's REST API", + Usage: "A path to a key file to use for HTTPS deployment of snap's REST API", } gitversion string @@ -132,12 +132,12 @@ type coreModule interface { } type managesTribe interface { - GetAgreement(name string) (*agreement.Agreement, perror.PulseError) + GetAgreement(name string) (*agreement.Agreement, perror.SnapError) GetAgreements() map[string]*agreement.Agreement - AddAgreement(name string) perror.PulseError - RemoveAgreement(name string) perror.PulseError - JoinAgreement(agreementName, memberName string) perror.PulseError - LeaveAgreement(agreementName, memberName string) perror.PulseError + AddAgreement(name string) perror.SnapError + RemoveAgreement(name string) perror.SnapError + JoinAgreement(agreementName, memberName string) perror.SnapError + LeaveAgreement(agreementName, memberName string) perror.SnapError GetMembers() []string GetMember(name string) *agreement.Member } @@ -151,7 +151,7 @@ func main() { } app := cli.NewApp() - app.Name = "pulsed" + app.Name = "snapd" app.Version = gitversion app.Usage = "A powerful telemetry agent framework" app.Flags = []cli.Flag{ @@ -189,7 +189,7 @@ func action(ctx *cli.Context) { log.Fatal("log path provided must be a directory") } - file, err := os.OpenFile(fmt.Sprintf("%s/pulse.log", logPath), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) + file, err := os.OpenFile(fmt.Sprintf("%s/snap.log", logPath), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { log.Fatal(err) } @@ -234,12 +234,12 @@ func action(ctx *cli.Context) { restKey := ctx.String("rest-key") restCert := ctx.String("rest-cert") - log.Info("Starting pulsed (version: ", gitversion, ")") + log.Info("Starting snapd (version: ", gitversion, ")") - // Set Max Processors for pulsed. + // Set Max Processors for snapd. setMaxProcs(maxProcs) - // Validate log level and trust level settings for pulsed + // Validate log level and trust level settings for snapd validateLevelSettings(logLevel, pluginTrust) controlOpts := []control.ControlOpt{ @@ -252,7 +252,7 @@ func action(ctx *cli.Context) { if err != nil { log.WithFields(log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "path": config, }).Fatal("unable to read config") @@ -262,7 +262,7 @@ func action(ctx *cli.Context) { if err != nil { log.WithFields(log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "path": config, }).Fatal("invalid config") @@ -330,7 +330,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", }).Fatal("need keyring file when trust is on (--keyring-file or -k)") } for _, k := range keyrings { @@ -339,7 +339,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "keyringPath": keyringPath, }).Fatal("Unable to determine absolute path to keyring file") @@ -349,7 +349,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "keyringPath": keyringPath, }).Fatal("bad keyring file") @@ -361,7 +361,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "keyringPath": keyringPath, }).Fatal(err) @@ -376,7 +376,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "keyringPath": keyringPath, }).Warning("unable to open keyring file. not adding to keyring path") @@ -393,7 +393,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "error": err.Error(), "keyringPath": keyringPath, }).Fatal("unable to open keyring file.") @@ -416,7 +416,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": p, }).Fatal(err) } @@ -426,7 +426,7 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": fullPath, }).Fatal(err) } @@ -439,7 +439,7 @@ func action(ctx *cli.Context) { if err != nil { log.WithFields(log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": fullPath, "plugin": file, }).Error(err) @@ -450,7 +450,7 @@ func action(ctx *cli.Context) { if err != nil { log.WithFields(log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": fullPath, "plugin": file.Name() + ".asc", }).Error(err) @@ -460,14 +460,14 @@ func action(ctx *cli.Context) { if err != nil { log.WithFields(log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": fullPath, "plugin": file, }).Error(err) } else { log.WithFields(log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "autodiscoverpath": fullPath, "plugin": file, "plugin-name": pl.Name(), @@ -505,8 +505,8 @@ func action(ctx *cli.Context) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", - }).Info("pulsed started") + "_module": "snapd", + }).Info("snapd started") // Switch log level to user defined log.Info("setting log level to: ", l[logLevel]) @@ -524,9 +524,9 @@ func monitorErrors(ch <-chan error) { os.Exit(1) } -// setMaxProcs configures runtime.GOMAXPROCS for pulsed. GOMAXPROCS can be set by using -// the env variable GOMAXPROCS and pulsed will honor this setting. A user can override the env -// variable by setting max-procs flag on the command line. Pulsed will be limited to the max CPUs +// setMaxProcs configures runtime.GOMAXPROCS for snapd. GOMAXPROCS can be set by using +// the env variable GOMAXPROCS and snapd will honor this setting. A user can override the env +// variable by setting max-procs flag on the command line. Snapd will be limited to the max CPUs // on the system even if the env variable or the command line setting is set above the max CPUs. // The default value if the env variable or the command line option is not set is 1. func setMaxProcs(maxProcs int) { @@ -537,14 +537,14 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "maxprocs": maxProcs, }).Error("Trying to set GOMAXPROCS to an invalid value") _maxProcs = 1 log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "maxprocs": _maxProcs, }).Warning("Setting GOMAXPROCS to 1") _maxProcs = 1 @@ -554,14 +554,14 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "maxprocs": maxProcs, }).Error("Trying to set GOMAXPROCS larger than number of CPUs available on system") _maxProcs = numProcs log.WithFields( log.Fields{ "_block": "main", - "_module": "pulsed", + "_module": "snapd", "maxprocs": _maxProcs, }).Warning("Setting GOMAXPROCS to number of CPUs on host") } @@ -574,7 +574,7 @@ func setMaxProcs(maxProcs int) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "given maxprocs": _maxProcs, "real maxprocs": actualNumProcs, }).Warning("not using given maxprocs") @@ -586,9 +586,9 @@ func startModule(m coreModule) error { if err == nil { log.WithFields( log.Fields{ - "block": "main", - "_module": "pulsed", - "pulse-module": m.Name(), + "block": "main", + "_module": "snapd", + "snap-module": m.Name(), }).Info("module started") } return err @@ -597,10 +597,10 @@ func startModule(m coreModule) error { func printErrorAndExit(name string, err error) { log.WithFields( log.Fields{ - "block": "main", - "_module": "pulsed", - "error": err.Error(), - "pulse-module": name, + "block": "main", + "_module": "snapd", + "error": err.Error(), + "snap-module": name, }).Fatal("error starting module") } @@ -614,22 +614,22 @@ func startInterruptHandling(modules ...coreModule) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", }).Info("shutting down modules") for _, m := range modules { log.WithFields( log.Fields{ - "block": "main", - "_module": "pulsed", - "pulse-module": m.Name(), + "block": "main", + "_module": "snapd", + "snap-module": m.Name(), }).Info("stopping module") m.Stop() } log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "signal": sig.String(), }).Info("exiting on signal") os.Exit(0) @@ -658,7 +658,7 @@ func validateLevelSettings(logLevel, pluginTrust int) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "level": logLevel, }).Fatal("log level was invalid (needs: 1-5)") } @@ -666,7 +666,7 @@ func validateLevelSettings(logLevel, pluginTrust int) { log.WithFields( log.Fields{ "block": "main", - "_module": "pulsed", + "_module": "snapd", "level": pluginTrust, }).Fatal("Plugin trust was invalid (needs: 0-2)") }