Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 127 lines (115 sloc) 4.999 kB
054a11a @gholms Update GPL+BSD file headers
gholms authored
1 /*************************************************************************
2 * Copyright 2009-2012 Eucalyptus Systems, Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see http://www.gnu.org/licenses/.
15 *
16 * Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
17 * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
18 * additional information or have any questions.
19 *
20 * This file may incorporate work covered under the following copyright
21 * and permission notice:
22 *
23 * Software License Agreement (BSD License)
24 *
25 * Copyright (c) 2008, Regents of the University of California
26 * All rights reserved.
27 *
28 * Redistribution and use of this software in source and binary forms,
29 * with or without modification, are permitted provided that the
30 * following conditions are met:
31 *
32 * Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 *
35 * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer
37 * in the documentation and/or other materials provided with the
38 * distribution.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
43 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
44 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
45 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
46 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
50 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 * POSSIBILITY OF SUCH DAMAGE. USERS OF THIS SOFTWARE ACKNOWLEDGE
52 * THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE LICENSED MATERIAL,
53 * COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS SOFTWARE,
54 * AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
55 * IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA,
56 * SANTA BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY,
57 * WHICH IN THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION,
58 * REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO
59 * IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
60 * NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
61 ************************************************************************/
476da3b added shutdownCC.c
Daniel Nurmi authored
62
63 #include <stdio.h>
64 #include <time.h>
65 #include <misc.h>
66 #include <euca_axis.h>
67 #include <data.h>
68 #include <cc-client-marshal.h>
69
081cba3 @dmitrii Keys mismatched fault and 'patch' fix in Makefile
dmitrii authored
70 #ifndef NO_COMP
71 const char * euca_this_component_name = "cc";
72 const char * euca_client_component_name = "clc";
73 #endif
74
476da3b added shutdownCC.c
Daniel Nurmi authored
75 ncMetadata mymeta;
76
77 int main(int argc, char **argv) {
78 axutil_env_t * env = NULL;
79 axis2_char_t * client_home = NULL;
80 axis2_char_t endpoint_uri[256], *tmpstr;
81 axis2_stub_t * stub = NULL;
82 int rc, i, port, use_wssec;
eb51cdd update to shutdownCC.c, more checking
Daniel Nurmi authored
83 char *euca_home, configFile[1024], policyFile[1024], logFile[1024];
476da3b added shutdownCC.c
Daniel Nurmi authored
84
eb51cdd update to shutdownCC.c, more checking
Daniel Nurmi authored
85 bzero(&mymeta, sizeof(ncMetadata));
476da3b added shutdownCC.c
Daniel Nurmi authored
86 mymeta.userId = strdup("admin");
87 mymeta.correlationId = strdup("shutdowncorrid");
88 mymeta.epoch = 1;
89 mymeta.servicesLen = 0;
90 euca_home = getenv("EUCALYPTUS");
91 if (!euca_home) {
59bc3e0 @a13m Remove hard-coded paths from C and Java code
a13m authored
92 euca_home = "";
476da3b added shutdownCC.c
Daniel Nurmi authored
93 }
59bc3e0 @a13m Remove hard-coded paths from C and Java code
a13m authored
94 snprintf(configFile, 1024, EUCALYPTUS_CONF_LOCATION, euca_home);
95 snprintf(policyFile, 1024, EUCALYPTUS_KEYS_DIR "/cc-client-policy.xml", euca_home);
96 snprintf(logFile, 1024, EUCALYPTUS_LOG_DIR "/shutdownCC_axis2c.log", euca_home);
476da3b added shutdownCC.c
Daniel Nurmi authored
97
eb51cdd update to shutdownCC.c, more checking
Daniel Nurmi authored
98 if (argc != 2 || !argv[1]) {
99 printf("must supply argument <host>:<port>\n");
100 }
cebbde6 remove whitespace before URL string in shutdownCC.c and CCclient.c.
Daniel Nurmi authored
101 snprintf(endpoint_uri, 256,"http://%s/axis2/services/EucalyptusCC", argv[1]);
476da3b added shutdownCC.c
Daniel Nurmi authored
102
eb51cdd update to shutdownCC.c, more checking
Daniel Nurmi authored
103 env = axutil_env_create_all(logFile, AXIS2_LOG_LEVEL_TRACE);
476da3b added shutdownCC.c
Daniel Nurmi authored
104
105 client_home = AXIS2_GETENV("AXIS2C_HOME");
106 if (!client_home) {
107 printf("must have AXIS2C_HOME set\n");
108 exit(1);
109 }
110 stub = axis2_stub_create_EucalyptusCC(env, client_home, endpoint_uri);
111
112 rc = InitWSSEC(env, stub, policyFile);
113 if (rc) {
114 printf("cannot initialize WS-SEC policy (%s)\n",policyFile);
115 exit(1);
116 }
117
118 rc = cc_shutdownService(env, stub);
119 if (rc != 0) {
120 printf("cc_shutdownService() failed\n");
121 exit(1);
122 }
eb51cdd update to shutdownCC.c, more checking
Daniel Nurmi authored
123
2f3726f add shutdown hook to cc init script on clean(restart|stop)
Daniel Nurmi authored
124 sleep(10);
476da3b added shutdownCC.c
Daniel Nurmi authored
125 exit(0);
126 }
Something went wrong with that request. Please try again.