------------------------------------------------------------
revno: 1419
committer: James Hunt <[email protected]>
branch nick: setenv+getenv
timestamp: Mon 2013-01-14 16:44:17 +0000
message:
  * util/initctl.c:
    - Grouped all environment commands in usage output.
    - Added --global, --job and --instance options for all environment
      commands. These are currently dummies, but --global will soon be
      required to make changes to the global job environment table when
      initctl is invoked from within a job.
modified:
  ChangeLog
  util/initctl.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'ChangeLog'
--- ChangeLog	2013-01-11 14:32:09 +0000
+++ ChangeLog	2013-01-14 16:44:17 +0000
@@ -1,3 +1,12 @@
+2013-01-14  James Hunt  <[email protected]>
+
+	* util/initctl.c:
+	  - Grouped all environment commands in usage output.
+	  - Added --global, --job and --instance options for all environment
+	    commands. These are currently dummies, but --global will soon be
+	    required to make changes to the global job environment table when
+	    initctl is invoked from within a job.
+
 2013-01-11  James Hunt  <[email protected]>
 
 	* util/tests/test_initctl.c:

=== modified file 'util/initctl.c'
--- util/initctl.c	2013-01-09 11:13:03 +0000
+++ util/initctl.c	2013-01-14 16:44:17 +0000
@@ -1,6 +1,6 @@
 /* upstart
  *
- * Copyright © 2010 Canonical Ltd.
+ * Copyright  2010 Canonical Ltd.
  * Author: Scott James Remnant <[email protected]>.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -214,6 +214,28 @@
 CheckConfigData check_config_data;
 
 /**
+ * apply_globally:
+ *
+ * If TRUE, make changes to global job environment table rather than the
+ * running jobs instances environment table.
+ **/
+int apply_globally = FALSE;
+
+/**
+ * job_name:
+ *
+ * Name of job to apply changes to.
+ **/
+const char *job_name = NULL;
+
+/**
+ * job_instance:
+ *
+ * Name of job instance to apply changes to.
+ **/
+const char *job_instance = NULL;
+
+/**
  * NihOption setter function to handle selection of appropriate D-Bus
  * bus.
  *
@@ -2742,12 +2764,78 @@
  * Command-line options accepted for the set-env command.
  **/
 NihOption set_env_options[] = {
+	{ 'g', "global", N_("apply to global job environment table"),
+	  NULL, NULL, &apply_globally, NULL },
+	{ 'i', "instance", N_("job instance name"),
+	  NULL, "INSTANCE", &job_instance, NULL },
+	{ 'j', "job", N_("job name"),
+	  NULL, "NAME", &job_name, NULL },
 	{ 'r', "retain", N_("do not replace the value of the variable if already set"),
 	  NULL, NULL, &retain_var, NULL },
 	NIH_OPTION_LAST
 };
 
 /**
+ * get_env_options:
+ *
+ * Command-line options accepted for the get-env command.
+ **/
+NihOption get_env_options[] = {
+	{ 'g', "global", N_("apply to global job environment table"),
+	  NULL, NULL, &apply_globally, NULL },
+	{ 'i', "instance", N_("job instance name"),
+	  NULL, "INSTANCE", &job_instance, NULL },
+	{ 'j', "job", N_("job name"),
+	  NULL, "NAME", &job_name, NULL },
+	NIH_OPTION_LAST
+};
+
+/**
+ * unset_env_options:
+ *
+ * Command-line options accepted for the unset-env command.
+ **/
+NihOption unset_env_options[] = {
+	{ 'g', "global", N_("apply to global job environment table"),
+	  NULL, NULL, &apply_globally, NULL },
+	{ 'i', "instance", N_("job instance name"),
+	  NULL, "INSTANCE", &job_instance, NULL },
+	{ 'j', "job", N_("job name"),
+	  NULL, "NAME", &job_name, NULL },
+	NIH_OPTION_LAST
+};
+
+/**
+ * list_env_options:
+ *
+ * Command-line options accepted for the list-env command.
+ **/
+NihOption list_env_options[] = {
+	{ 'g', "global", N_("apply to global job environment table"),
+	  NULL, NULL, &apply_globally, NULL },
+	{ 'i', "instance", N_("job instance name"),
+	  NULL, "INSTANCE", &job_instance, NULL },
+	{ 'j', "job", N_("job name"),
+	  NULL, "NAME", &job_name, NULL },
+	NIH_OPTION_LAST
+};
+
+/**
+ * reset_env_options:
+ *
+ * Command-line options accepted for the reset-env command.
+ **/
+NihOption reset_env_options[] = {
+	{ 'g', "global", N_("apply to global job environment table"),
+	  NULL, NULL, &apply_globally, NULL },
+	{ 'i', "instance", N_("job instance name"),
+	  NULL, "INSTANCE", &job_instance, NULL },
+	{ 'j', "job", N_("job name"),
+	  NULL, "NAME", &job_name, NULL },
+	NIH_OPTION_LAST
+};
+
+/**
  * usage_options:
  *
  * Command-line options accepted for the usage command.
@@ -2771,6 +2859,13 @@
 static NihCommandGroup event_commands = { N_("Event") };
 
 /**
+ * env_group:
+ *
+ * Group of commands related to Job environment variables.
+ **/
+static NihCommandGroup env_group = { N_("Environment") };
+
+/**
  * commands:
  *
  * Commands accepts as the first non-option argument, or program name.
@@ -2879,27 +2974,27 @@
 	{ "get-env", N_("VARIABLE"),
 	  N_("Retrieve value of a job environment variable."),
 	  N_("Display the value of a variable from the job environment table."),
-	  NULL, NULL, get_env_action },
+	  &env_group, get_env_options, get_env_action },
 
 	{ "list-env", NULL,
 	  N_("Show all job environment variables."),
 	  N_("Displays sorted list of variables and their values from the job environment table."),
-	  NULL, NULL, list_env_action },
+	  &env_group, list_env_options, list_env_action },
 
 	{ "reset-env", N_("VARIABLE"),
 	  N_("Revert all job environment variable changes."),
 	  N_("Discards all changes make to the job environment table, setting it back to its default value."),
-	  NULL, NULL, reset_env_action },
+	  &env_group, reset_env_options, reset_env_action },
 
 	{ "set-env", N_("VARIABLE[=VALUE]"),
 	  N_("Set a job environment variable."),
 	  N_("Adds or updates a variable in the job environment table."),
-	  NULL, set_env_options, set_env_action },
+	  &env_group, set_env_options, set_env_action },
 
 	{ "unset-env", N_("VARIABLE"),
 	  N_("Remove a job environment variable."),
 	  N_("Discards the specified variable from the job environment table."),
-	  NULL, NULL, unset_env_action },
+	  &env_group, unset_env_options, unset_env_action },
 
 	{ "usage",  N_("JOB"),
 	  N_("Show job usage message if available."),

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to