Permalink
Browse files

Add optional --description flag for group sync.

  • Loading branch information...
1 parent a7c754a commit 8ea3e3957c8657938d0eb40b76bda146414c027a Ryan Morgan committed Mar 26, 2009
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/org/hyperic/hq/hqapi1/tools/GroupCommand.java
@@ -39,6 +39,7 @@
private static String OPT_PROTOTYPE = "prototype";
private static String OPT_REGEX = "regex";
private static String OPT_DELETEMISSING = "deleteMissing";
+ private static String OPT_DESC = "description";
private void printUsage() {
System.err.println("One of " + Arrays.toString(COMMANDS) + " required");
@@ -106,6 +107,8 @@ private void sync(String[] args) throws Exception {
p.accepts(OPT_DELETEMISSING, "Remove resources in the group not included in " +
"the " + OPT_PROTOTYPE + " and " + OPT_REGEX);
p.accepts(OPT_COMPAT, "If specified, attempt to make the group compatible");
+ p.accepts(OPT_DESC, "If specified, set the description for the group").
+ withRequiredArg().ofType(String.class);
OptionSet options = getOptions(p, args);
@@ -137,6 +140,7 @@ private void syncViaCommandLineArgs(OptionSet s) throws Exception
// Optional
String regex = (String)s.valueOf(OPT_REGEX);
+ String description = (String)s.valueOf(OPT_DESC);
boolean deleteMissing = s.has(OPT_DELETEMISSING);
boolean compatible = s.has(OPT_COMPAT);
@@ -189,6 +193,10 @@ private void syncViaCommandLineArgs(OptionSet s) throws Exception
System.out.println(name + ": Creating new group");
}
+ if (s.hasArgument(OPT_DESC)) {
+ group.setDescription((String)s.valueOf(OPT_DESC));
+ }
+
group.getResource().addAll(resources);
List<Group> groups = new ArrayList<Group>();
groups.add(group);

0 comments on commit 8ea3e39

Please sign in to comment.