Issue 452 os_name -> os_description, +description

This commit is contained in:
Adrian Cole 2011-01-28 16:22:57 -08:00
parent ce82c05222
commit f0a4a23265
9 changed files with 47 additions and 34 deletions

View File

@ -42,14 +42,17 @@ You must define your nodes in yaml, and they must be in a collection called node
Here are the properties:
* id - opaque unique id
* name - optional; user specified name
* description - optional; long description of this node
* note this is not yet in jclouds NodeMetadata
* hostname - name or ip address to contact the node on
* os_arch - ex. x86
* os_family - must conform to org.jclouds.compute.domain.OsFamily in lower-hyphen format
ex. rhel, ubuntu, centos, debian, amzn-linux
* os_name - ex. redhat
* os_description - long description of the os ex. Ubuntu with lamp stack
* os_version - normalized to numbers when possible. ex. for centos: 5.3, ubuntu: 10.10
* group - primary group of the machine. ex. hadoop
* tags - list of arbitrary tags. * note this list is not yet in jclouds NodeMetadata
* tags - optional; list of arbitrary tags.
* note this list is not yet in jclouds NodeMetadata
* username - primary login user to the os. ex. ubuntu, vcloud, root
* sudo_password - optional; base 64 encoded sudo password (ex. input to sudo -S)
one of:
@ -61,12 +64,13 @@ Here are the properties:
=== Example File ===
nodes:
- id: cluster-1
- id: i-sdfkjh7
name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com
os_arch: x86
os_family: rhel
os_name: redhat
os_description: redhat with CDH
os_version: 5.3
group: hadoop
tags:

View File

@ -36,15 +36,16 @@ public class Node {
public Node() {
}
public Node(String id, String name, String hostname, String osArch, String osFamily,
String osName, String osVersion, String group, List<String> tags, String username, String credential,
URI credentialUrl, String sudo_password) {
public Node(String id, String name, String description, String hostname, String osArch, String osFamily,
String osDescription, String osVersion, String group, List<String> tags, String username,
String credential, URI credentialUrl, String sudo_password) {
this.id = id;
this.name = name;
this.description = description;
this.hostname = hostname;
this.os_arch = osArch;
this.os_family = osFamily;
this.os_name = osName;
this.os_description = osDescription;
this.os_version = osVersion;
this.group = group;
this.tags = ImmutableList.copyOf(tags);
@ -57,10 +58,11 @@ public class Node {
// public due to snakeyaml
public String id;
public String name;
public String description;
public String hostname;
public String os_arch;
public String os_family;
public String os_name;
public String os_description;
public String os_version;
public String group;
public List<String> tags;
@ -77,6 +79,10 @@ public class Node {
return name;
}
public String getDescription() {
return description;
}
public String getGroup() {
return group;
}
@ -93,8 +99,8 @@ public class Node {
return os_family;
}
public String getOsName() {
return os_name;
public String getOsDescription() {
return os_description;
}
public String getOsVersion() {
@ -138,10 +144,10 @@ public class Node {
@Override
public String toString() {
return Objects.toStringHelper(this).add("id", id).add("name", name).add(
"hostname", hostname).add("osArch", os_arch).add("osFamily", os_family).add("osName", os_name).add(
"osVersion", os_version).add("group", group).add("tags", tags).add("username", username).add(
"hasCredential", credential != null || credential_url != null).add("hasSudoPassword",
return Objects.toStringHelper(this).add("id", id).add("name", name).add("description", description).add(
"hostname", hostname).add("osArch", os_arch).add("osFamily", os_family).add("osDescription",
os_description).add("osVersion", os_version).add("group", group).add("tags", tags).add("username",
username).add("hasCredential", credential != null || credential_url != null).add("hasSudoPassword",
sudo_password != null).toString();
}

View File

@ -76,7 +76,7 @@ public class NodeToNodeMetadata implements Function<Node, NodeMetadata> {
builder.tag(from.getGroup());
// TODO add tags!
builder.operatingSystem(new OperatingSystemBuilder().arch(from.getOsArch()).family(
OsFamily.fromValue(from.getOsFamily())).name(from.getOsName()).description(from.getOsName()).version(
OsFamily.fromValue(from.getOsFamily())).description(from.getOsDescription()).version(
from.getOsVersion()).build());
builder.state(NodeState.RUNNING);
builder.publicAddresses(ImmutableSet.<String> of(from.getHostname()));

View File

@ -47,7 +47,7 @@ import com.google.common.collect.Maps;
* hostname: cluster-1.mydomain.com
* os_arch: x86
* os_family: linux
* os_name: redhat
* os_description: redhat
* os_version: 5.3
* group: hadoop
* tags:

View File

@ -63,7 +63,7 @@ public class BYONComputeServiceLiveTest {
nodes.append(" hostname: localhost\n");
nodes.append(" os_arch: ").append(System.getProperty("os.arch")).append("\n");
nodes.append(" os_family: ").append(OsFamily.UNIX).append("\n");
nodes.append(" os_name: ").append(System.getProperty("os.name")).append("\n");
nodes.append(" os_description: ").append(System.getProperty("os.name")).append("\n");
nodes.append(" os_version: ").append(System.getProperty("os.version")).append("\n");
nodes.append(" group: ").append("ssh").append("\n");
nodes.append(" tags:\n");

View File

@ -50,7 +50,7 @@ public class NodeToNodeMetadataTest {
public static final NodeMetadata TEST1 = new NodeMetadataBuilder().ids("cluster-1").tag("hadoop").name("cluster-1")
.location(location).state(NodeState.RUNNING).operatingSystem(
new OperatingSystemBuilder().name("redhat").description("redhat").family(OsFamily.RHEL)
new OperatingSystemBuilder().description("redhat").family(OsFamily.RHEL)
.arch("x86").version("5.3").build()).publicAddresses(
ImmutableSet.of("cluster-1.mydomain.com")).credentials(new Credentials("myUser", "fancyfoot"))
.adminPassword("sudo").build();

View File

@ -37,9 +37,10 @@ import com.google.common.collect.ImmutableMap;
*/
public class NodesFromYamlTest {
public static final Node TEST1 = new Node("cluster-1", "cluster-1", "cluster-1.mydomain.com", "x86", "rhel",
"redhat", "5.3", "hadoop", ImmutableList.of("vanilla"), "myUser", CryptoStreams.base64("fancyfoot"
.getBytes()), null, CryptoStreams.base64("sudo".getBytes()));
public static final Node TEST1 = new Node("cluster-1", "cluster-1", "accounting analytics cluster",
"cluster-1.mydomain.com", "x86", "rhel", "redhat", "5.3", "hadoop", ImmutableList
.of("vanilla"), "myUser", CryptoStreams.base64("fancyfoot".getBytes()), null, CryptoStreams
.base64("sudo".getBytes()));
@Test
public void testNodesParse() throws Exception {

View File

@ -1,10 +1,11 @@
nodes:
- id: cluster-1
name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com
os_arch: x86
os_family: rhel
os_name: redhat
os_description: redhat
os_version: 5.3
group: hadoop
tags:

View File

@ -1,10 +1,11 @@
nodes:
- id: cluster-1
name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com
os_arch: x86
os_family: rhel
os_name: redhat
os_description: redhat
os_version: 5.3
group: hadoop
tags: