chefclient


License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

org.nefilim
ArtifactId

ArtifactId

chefclient_2.10
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

chefclient
chefclient
Project URL

Project URL

https://github.com/nefilim/ScalaChefClient
Project Organization

Project Organization

org.nefilim
Source Code Management

Source Code Management

https://github.com/nefilim/ScalaChefClient.git

Download chefclient_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/org.nefilim/chefclient_2.10/ -->
<dependency>
    <groupId>org.nefilim</groupId>
    <artifactId>chefclient_2.10</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.nefilim/chefclient_2.10/
implementation 'org.nefilim:chefclient_2.10:0.2'
// https://jarcasting.com/artifacts/org.nefilim/chefclient_2.10/
implementation ("org.nefilim:chefclient_2.10:0.2")
'org.nefilim:chefclient_2.10:jar:0.2'
<dependency org="org.nefilim" name="chefclient_2.10" rev="0.2">
  <artifact name="chefclient_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.nefilim', module='chefclient_2.10', version='0.2')
)
libraryDependencies += "org.nefilim" % "chefclient_2.10" % "0.2"
[org.nefilim/chefclient_2.10 "0.2"]

Dependencies

compile (10)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.4
com.typesafe : scalalogging-slf4j_2.10 jar 1.0.1
io.spray : spray-client jar 1.3.1
io.spray : spray-routing jar 1.3.1
org.json4s : json4s-native_2.10 jar 3.2.7
org.json4s : json4s-jackson_2.10 jar 3.2.7
com.typesafe.akka : akka-actor_2.10 jar 2.3.1
org.bouncycastle : bcprov-jdk15on jar 1.50
org.bouncycastle : bcpkix-jdk15on jar 1.50
commons-codec : commons-codec jar 1.9

test (3)

Group / Artifact Type Version
org.scalatest : scalatest_2.10 jar 2.0
ch.qos.logback : logback-classic jar 1.1.1
io.spray : spray-testkit jar 1.3.1

Project Modules

There are no modules declared in this project.

ChefClientScala

Very minimal Chef Server async client written in Scala (2.10) with Spray (1.3.1). The motivation for this library is to do network discovery and drive an operational dashboard. Also used by https://github.com/nefilim/SNSMonitor

Supported operations

  • List all nodes
  • Search the node index
  • Deleting a node
  • Deleting a client

Sample Usage

Operations returns:

Future[Either[ChefClientFailedResult, T]]

Usage:

      val chefClient = ChefClient(keyPath, "theuser", "api.opscode.com", Some("/organizations/myorg"))
      val f1 = chefClient.nodeList()
      f1.onComplete {
        case Success(success) =>
          success match {
            case Right(r) =>
              r.foreach(logger.info("node {}", _))
            case Left(l) =>
              logger.error("failed {}", l)
          }
        case Failure(failure) =>
          logger.error("node list failure {}", failure)
      }

      val f2 = chefClient.searchNodeIndex("name:*")
      f2.onComplete {
        case Success(searchResult) =>
          searchResult match {
            case Right(r) =>
              r.rows.foreach(logger.info("node {}", _))
            case Left(l) =>
              logger.error("failed {}", l)
          }
        case Failure(failure) =>
          logger.error("search result failure {}", failure)
      }

      val f3 = chefClient.deleteClient("app-i-e3ade6eb")
      f3.onComplete {
        case Success(result) =>
          logger.info("deleted client {}", result)
          result.isRight should be (true)
          result.right.get.status should be (StatusCodes.OK)
        case Failure(failure) =>
          logger.error("delete client failure {}", failure)
      }

      val f4 = chefClient.deleteNode("app-i-e3ade6eb")
      f4.onComplete {
        case Success(result) =>
          logger.info("deleted node {}", result)
          result.isRight should be (true)
        case Failure(failure) =>
          logger.error("delete node failure {}", failure)
      }

Versions

Version
0.2
0.1