This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
forked from tumblr/collins
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tumblr#77 from cburroughs/server-lshw
extract server product/vendor information with lshw
- Loading branch information
Showing
12 changed files
with
174 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package models.lshw | ||
|
||
import play.api.libs.json._ | ||
|
||
object ServerBase { | ||
import Json._ | ||
implicit object ServerbaseFormat extends Format[ServerBase] { | ||
override def reads(json: JsValue) = ServerBase( | ||
(json \ "DESCRIPTION").as[String], | ||
(json \ "PRODUCT").as[String], | ||
(json \ "VENDOR").as[String] | ||
) | ||
override def writes(serverbase: ServerBase) = JsObject(Seq( | ||
"DESCRIPTION" -> toJson(serverbase.description), | ||
"PRODUCT" -> toJson(serverbase.product), | ||
"VENDOR" -> toJson(serverbase.vendor) | ||
)) | ||
} | ||
} | ||
|
||
case class ServerBase( | ||
description: String = "", product: String = "", vendor: String = "" | ||
) extends LshwAsset { | ||
import ServerBase._ | ||
override def toJsValue() = Json.toJson(this) | ||
|
||
def isEmpty(): Boolean = description.isEmpty && product.isEmpty && vendor.isEmpty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# --- Include new common server base fields | ||
|
||
# --- !Ups | ||
|
||
INSERT INTO asset_meta VALUES (0, 'BASE_PRODUCT', 1, 'Base Product', 'Formal product model designation', 1); | ||
INSERT INTO asset_meta VALUES (0, 'BASE_VENDOR', 1, 'Base Vendor', 'Who made your spiffy computer?', 1); | ||
INSERT INTO asset_meta VALUES (0, 'BASE_DESCRIPTION', -1, 'Base Description', 'How does your computer introduce itself?', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters