Permalink
Browse files

Update extra-version code

  • Loading branch information...
1 parent e1c086b commit 186215fadf10dbc49b669bd1e0cc34886c59d855 @gholms gholms committed May 11, 2012
@@ -6,6 +6,7 @@ version "@EUCA_VERSION@"
section "Bootstrap Configuration"# # # # # #
option "user" u "User to drop privs to after starting." string typestr="USERNAME" default="eucalyptus" no
option "home" h "Eucalyptus home directory." string typestr="DIRECTORY" default="@prefix@/" no
+option "extra-version" - "Extra version string." string typestr="EXTRAVERSION" default="@EXTRA_VERSION@" no hidden
option "initialize" - "Perform first-time setup. This is run one time (only!) on the first cloud controller before the first time it is run." flag off
option "bind-addr" i "Specifying this option causes eucalyptus-cloud to only bind the specified local addresses. The default behaviour is to listen on the any address while determining the user facing local address based on default route and netmask size." string typestr="HOSTNAME" optional multiple
@@ -416,6 +416,8 @@ int main(int argc, char *argv[]) {
int i;
if (arguments(argc, argv, args) != 0)
exit(1);
+ if (args->extra_version_orig != NULL)
+ args->extra_version_arg = args->extra_version_orig;
debug = args->debug_flag;
set_output(GETARG(args, out), GETARG(args, err));
if (args->kill_flag == 1)
@@ -764,9 +766,11 @@ int java_init(euca_opts *args, java_home_t *data) {
}
}
JVM_ARG(opt[++x], "-Deuca.version=%1$s", ARGUMENTS_VERSION);
- JVM_ARG(opt[++x], "-Deuca.extra_version=%1$s", ARGUMENTS_EXTRA_VERSION);
JVM_ARG(opt[++x], "-Deuca.log.level=%1$s", GETARG(args, log_level));
JVM_ARG(opt[++x], "-Deuca.log.appender=%1$s", GETARG(args, log_appender));
+ if (strlen(GETARG(args, extra_version)) > 1 && strncmp(GETARG(args, extra_version), "@", 1)) {
+ JVM_ARG(opt[++x], "-Deuca.extra_version=%1$s", GETARG(args, extra_version));
+ }
if (args->initialize_flag) {
JVM_ARG(opt[++x], "-Deuca.initialize=true");
JVM_ARG(opt[++x], "-Deuca.remote.dns=true");
@@ -839,7 +843,12 @@ int java_init(euca_opts *args, java_home_t *data) {
arg.options = opt;
if (debug) {
__debug("+-------------------------------------------------------");
- __debug("| Version: %x", arg.version);
+ if (strlen(GETARG(args, extra_version)) > 1 && strncmp(GETARG(args, extra_version), "@", 1))
+ __debug("| Eucalyptus version: %s-%s", ARGUMENTS_VERSION, GETARG(args, extra_version));
+ else
+ __debug("| Eucalyptus version: %s", ARGUMENTS_VERSION);
+
+ __debug("| JNI version: %x", arg.version);
__debug("| Ignore Unrecognized Arguments: %d", arg.ignoreUnrecognized);
__debug("| Extra options: %d", arg.nOptions);
for (x = 0; x < arg.nOptions; x++)
Oops, something went wrong.
@@ -1,6 +1,6 @@
/** @file eucalyptus-opts.h
* @brief The header file for the command line option parser
- * generated by GNU Gengetopt version 2.22.2
+ * generated by GNU Gengetopt version 2.22.3
* http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */
@@ -34,11 +34,6 @@ extern "C" {
#define ARGUMENTS_VERSION "3.1.0"
#endif
-#ifndef ARGUMENTS_EXTRA_VERSION
-/** @brief Eucalyptus extra version string */
-#define ARGUMENTS_EXTRA_VERSION "unconfigured"
-#endif
-
/** @brief Where the command line options are stored */
struct eucalyptus_opts
{
@@ -48,9 +43,12 @@ struct eucalyptus_opts
char * user_arg; /**< @brief User to drop privs to after starting. (default='eucalyptus'). */
char * user_orig; /**< @brief User to drop privs to after starting. original value given at command line. */
const char *user_help; /**< @brief User to drop privs to after starting. help description. */
- char * home_arg; /**< @brief Eucalyptus home directory. (default='/opt/git-main/'). */
+ char * home_arg; /**< @brief Eucalyptus home directory. (default='/'). */
char * home_orig; /**< @brief Eucalyptus home directory. original value given at command line. */
const char *home_help; /**< @brief Eucalyptus home directory. help description. */
+ char * extra_version_arg; /**< @brief Extra version string. (default=''). */
+ char * extra_version_orig; /**< @brief Extra version string. original value given at command line. */
+ const char *extra_version_help; /**< @brief Extra version string. help description. */
int initialize_flag; /**< @brief Perform first-time setup. This is run one time (only!) on the first cloud controller before the first time it is run. (default=off). */
const char *initialize_help; /**< @brief Perform first-time setup. This is run one time (only!) on the first cloud controller before the first time it is run. help description. */
char ** bind_addr_arg; /**< @brief Specifying this option causes eucalyptus-cloud to only bind the specified local addresses. The default behaviour is to listen on the any address while determining the user facing local address based on default route and netmask size.. */
@@ -74,7 +72,7 @@ struct eucalyptus_opts
const char *fork_help; /**< @brief Fork and daemonize Eucalyptus. help description. */
int kill_flag; /**< @brief Kill a daemonized Eucalyptus. (default=off). */
const char *kill_help; /**< @brief Kill a daemonized Eucalyptus. help description. */
- char * pidfile_arg; /**< @brief Location for the pidfile. (default='/opt/git-main/var/run/eucalyptus-cloud.pid'). */
+ char * pidfile_arg; /**< @brief Location for the pidfile. (default='/var/run/eucalyptus-cloud.pid'). */
char * pidfile_orig; /**< @brief Location for the pidfile. original value given at command line. */
const char *pidfile_help; /**< @brief Location for the pidfile. help description. */
char * db_home_arg; /**< @brief Set path to database home directory (default='/usr/pgsql-9.1/'). */
@@ -120,7 +118,7 @@ struct eucalyptus_opts
const char *disable_dns_help; /**< @brief DEPRECATED DO NOT USE. IT DOES NOTHING. help description. */
int disable_storage_flag; /**< @brief DEPRECATED DO NOT USE. IT DOES NOTHING. (default=off). */
const char *disable_storage_help; /**< @brief DEPRECATED DO NOT USE. IT DOES NOTHING. help description. */
- char ** java_home_arg; /**< @brief Alternative way to specify JAVA_HOME. (default='/usr/lib/jvm/java-6-openjdk/'). */
+ char ** java_home_arg; /**< @brief Alternative way to specify JAVA_HOME. (default='/usr/lib/jvm/java'). */
char ** java_home_orig; /**< @brief Alternative way to specify JAVA_HOME. original value given at command line. */
unsigned int java_home_min; /**< @brief Alternative way to specify JAVA_HOME.'s minimum occurreces */
unsigned int java_home_max; /**< @brief Alternative way to specify JAVA_HOME.'s maximum occurreces */
@@ -160,6 +158,7 @@ struct eucalyptus_opts
unsigned int version_given ; /**< @brief Whether version was given. */
unsigned int user_given ; /**< @brief Whether user was given. */
unsigned int home_given ; /**< @brief Whether home was given. */
+ unsigned int extra_version_given ; /**< @brief Whether extra-version was given. */
unsigned int initialize_given ; /**< @brief Whether initialize was given. */
unsigned int bind_addr_given ; /**< @brief Whether bind-addr was given. */
unsigned int bootstrap_host_given ; /**< @brief Whether bootstrap-host was given. */
@@ -228,7 +227,7 @@ extern const char *eucalyptus_opts_full_help[];
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int arguments (int argc, char * const *argv,
+int arguments (int argc, char **argv,
struct eucalyptus_opts *args_info);
/**
@@ -242,7 +241,7 @@ int arguments (int argc, char * const *argv,
* @return 0 if everything went fine, NON 0 if an error took place
* @deprecated use arguments_ext() instead
*/
-int arguments2 (int argc, char * const *argv,
+int arguments2 (int argc, char **argv,
struct eucalyptus_opts *args_info,
int override, int initialize, int check_required);
@@ -254,7 +253,7 @@ int arguments2 (int argc, char * const *argv,
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
-int arguments_ext (int argc, char * const *argv,
+int arguments_ext (int argc, char **argv,
struct eucalyptus_opts *args_info,
struct arguments_params *params);
@@ -680,14 +680,23 @@ public static void setWalrusConfiguration( SearchResultRow input ) throws Eucaly
private static String getExternalIpAddress ( ) {
String ipAddr = null;
HttpClient httpClient = new HttpClient( );
+
//set User-Agent
- String version = System.getProperty("euca.version");
- String extraVersion = System.getProperty("euca.extra_version");
- HttpParams defaultParams = httpClient.getParams().getDefaults();
- httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
- defaultParams.getParameter(
- HttpMethodParams.USER_AGENT) +
- " " + version + "-" + extraVersion);
+ String clientVersion = (String)httpClient.getParams().getDefaults().getParameter(HttpMethodParams.USER_AGENT);
+ String javaVersion = System.getProperty("java.version");
+ String osName = System.getProperty("os.name");
+ String osArch = System.getProperty("os.arch");
+ String eucaVersion = System.getProperty("euca.version");
+ String extraVersion = System.getProperty("euca.extra_version");
+
+ // Jakarta Commons-HttpClient/3.1 (java 1.6.0_24; Linux amd64) Eucalyptus/3.1.0-1.el6
+ String userAgent = clientVersion + " (java " + javaVersion + "; " +
+ osName + " " + osArch + ") Eucalyptus/" + eucaVersion;
+ if (extraVersion != null) {
+ userAgent = userAgent + "-" + extraVersion;
+ }
+
+ httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent);
//support for http proxy
if( HttpServerBootstrapper.httpProxyHost != null && ( HttpServerBootstrapper.httpProxyHost.length( ) > 0 ) ) {
@@ -26,14 +26,24 @@
ArrayList<DownloadInfo> downloadsList = Lists.newArrayList( );
HttpClient httpClient = new HttpClient( );
+
//set User-Agent
- String version = System.getProperty("euca.version");
- String extraVersion = System.getProperty("euca.extra_version");
- HttpParams defaultParams = httpClient.getParams().getDefaults();
- httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
- defaultParams.getParameter(
- HttpMethodParams.USER_AGENT) +
- " " + version + "-" + extraVersion);
+ String clientVersion = (String)httpClient.getParams().getDefaults().getParameter(HttpMethodParams.USER_AGENT);
+ String javaVersion = System.getProperty("java.version");
+ String osName = System.getProperty("os.name");
+ String osArch = System.getProperty("os.arch");
+ String eucaVersion = System.getProperty("euca.version");
+ String extraVersion = System.getProperty("euca.extra_version");
+
+ // Jakarta Commons-HttpClient/3.1 (java 1.6.0_24; Linux amd64) Eucalyptus/3.1.0-1.el6
+ String userAgent = clientVersion + " (java " + javaVersion + "; " +
+ osName + " " + osArch + ") Eucalyptus/" + eucaVersion;
+ if (extraVersion != null) {
+ userAgent = userAgent + "-" + extraVersion;
+ }
+
+ httpClient.getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent);
+
//support for http proxy
if ( HttpServerBootstrapper.httpProxyHost != null && (HttpServerBootstrapper.httpProxyHost.length( ) > 0 ) ) {
String proxyHost = HttpServerBootstrapper.httpProxyHost;
Oops, something went wrong.

0 comments on commit 186215f

Please sign in to comment.