openwsman 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/openwsman/openwsman_wrap.c +736 -767
- data/ext/ruby/helpers.h +57 -23
- data/lib/openwsman/openwsman.rb +4 -2
- metadata +87 -54
data/ext/ruby/helpers.h
CHANGED
@@ -40,7 +40,21 @@
|
|
40
40
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
41
41
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
42
42
|
*****************************************************************************/
|
43
|
-
|
43
|
+
|
44
|
+
|
45
|
+
/*
|
46
|
+
* Get access to Ruby klass pointers
|
47
|
+
*
|
48
|
+
*/
|
49
|
+
|
50
|
+
#if SWIGVERSION > 0x020004
|
51
|
+
#define KLASS_DECL(k,t) swig_class *k = (swig_class *)(t->clientdata)
|
52
|
+
#define KLASS_OF(x) x->klass
|
53
|
+
#else
|
54
|
+
#define KLASS_DECL(k,t) extern swig_class k
|
55
|
+
#define KLASS_OF(x) x.klass
|
56
|
+
#endif
|
57
|
+
|
44
58
|
/* convert char* to string VALUE */
|
45
59
|
static VALUE
|
46
60
|
makestring( const char *s )
|
@@ -92,17 +106,16 @@ hash2value( hash_t *hash )
|
|
92
106
|
}
|
93
107
|
|
94
108
|
|
95
|
-
/* add key,value VALUE pair to hash_t*
|
109
|
+
/* add key,value VALUE pair to hash_t* as char*
|
96
110
|
* (used as callback for value2hash)
|
97
111
|
*/
|
98
112
|
static int
|
99
|
-
|
113
|
+
_add_str( VALUE key, VALUE value, hash_t *h )
|
100
114
|
{
|
101
115
|
if (key != Qundef) {
|
102
116
|
const char *k = as_string( key );
|
103
|
-
const char *v = as_string( value );
|
104
|
-
|
105
117
|
if (!hash_lookup( h, k ) ) {
|
118
|
+
const char *v = as_string( value );
|
106
119
|
if ( !hash_alloc_insert( h, k, v ) ) {
|
107
120
|
rb_raise( rb_eException, "hash_alloc_insert failed" );
|
108
121
|
}
|
@@ -112,9 +125,39 @@ add_i( VALUE key, VALUE value, hash_t *h )
|
|
112
125
|
}
|
113
126
|
|
114
127
|
|
115
|
-
/*
|
128
|
+
/* add key,value VALUE pair to hash_t* as selector_entry*
|
129
|
+
* (used as callback for value2hash)
|
130
|
+
*/
|
131
|
+
static int
|
132
|
+
_add_selector( VALUE key, VALUE value, hash_t *h )
|
133
|
+
{
|
134
|
+
if (key != Qundef) {
|
135
|
+
const char *k = as_string( key );
|
136
|
+
if (!hash_lookup( h, k ) ) {
|
137
|
+
selector_entry *entry = u_malloc(sizeof(selector_entry));
|
138
|
+
entry->type = 0;
|
139
|
+
entry->entry.text = strdup(as_string( value ));
|
140
|
+
if ( !hash_alloc_insert( h, k, entry ) ) {
|
141
|
+
rb_raise( rb_eException, "hash_alloc_insert failed" );
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
return 0;
|
146
|
+
}
|
147
|
+
|
148
|
+
|
149
|
+
/*
|
150
|
+
* Convert Ruby Hash to hash_t
|
151
|
+
*
|
152
|
+
* create hash (h == NULL) or add to hash (h != NULL) from hash VALUE
|
153
|
+
*
|
154
|
+
* valuetype - type of hash values
|
155
|
+
* 0 - values are string (char *)
|
156
|
+
* 1 - values are selector_entry *
|
157
|
+
*
|
158
|
+
*/
|
116
159
|
static hash_t *
|
117
|
-
value2hash( hash_t *h, VALUE v )
|
160
|
+
value2hash( hash_t *h, VALUE v, int valuetype )
|
118
161
|
{
|
119
162
|
if (NIL_P(v)) return NULL;
|
120
163
|
|
@@ -122,7 +165,7 @@ value2hash( hash_t *h, VALUE v )
|
|
122
165
|
|
123
166
|
if (!h) h = hash_create(HASHCOUNT_T_MAX, 0, 0);
|
124
167
|
|
125
|
-
rb_hash_foreach( v,
|
168
|
+
rb_hash_foreach( v, (valuetype==0)?_add_str:_add_selector, (unsigned long)h );
|
126
169
|
|
127
170
|
return h;
|
128
171
|
}
|
@@ -135,25 +178,12 @@ value2hash( hash_t *h, VALUE v )
|
|
135
178
|
static void
|
136
179
|
auth_request_callback( WsManClient *client, wsman_auth_type_t t, char **username, char **password )
|
137
180
|
{
|
181
|
+
KLASS_DECL(SwigClassTransport,SWIGTYPE_p__WsManTransport);
|
138
182
|
|
139
|
-
/*
|
140
|
-
* Uhm, swig 1.3.40 (or earlier) renamed its internal class variables from
|
141
|
-
* cFoo to SwigClassFoo
|
142
|
-
* 1.3.36 certainly used cFoo
|
143
|
-
*
|
144
|
-
*/
|
145
|
-
|
146
|
-
#if SWIG_VERSION < 0x010340
|
147
|
-
#define TRANSPORT_CLASS cTransport
|
148
|
-
#else
|
149
|
-
#define TRANSPORT_CLASS SwigClassTransport
|
150
|
-
#endif
|
151
|
-
|
152
|
-
extern swig_class TRANSPORT_CLASS;
|
153
183
|
VALUE c = SWIG_NewPointerObj((void*) client, SWIGTYPE_p__WsManClient, 0);
|
154
184
|
|
155
185
|
/* ruby callback */
|
156
|
-
VALUE result = rb_funcall(
|
186
|
+
VALUE result = rb_funcall( KLASS_OF(SwigClassTransport), rb_intern( "auth_request_callback" ), 2, c, INT2NUM( t ) );
|
157
187
|
|
158
188
|
if (CLASS_OF( result ) == rb_cArray) {
|
159
189
|
if (RARRAY_LEN(result) == 2 ) {
|
@@ -167,4 +197,8 @@ auth_request_callback( WsManClient *client, wsman_auth_type_t t, char **username
|
|
167
197
|
return;
|
168
198
|
}
|
169
199
|
|
200
|
+
static int associators_references( void *filter, int type, VALUE epr_v,
|
201
|
+
VALUE assocClass_v, VALUE resultClass_v, VALUE role_v, VALUE resultRole_v,
|
202
|
+
VALUE resultProp_v, VALUE propNum_v);
|
203
|
+
|
170
204
|
#endif /* RUBY_HELPERS_H */
|
data/lib/openwsman/openwsman.rb
CHANGED
@@ -36,7 +36,7 @@ module Openwsman
|
|
36
36
|
#
|
37
37
|
def self.epr_prefix_for classname, namespace = nil
|
38
38
|
prefix = Openwsman::uri_prefix classname
|
39
|
-
prefix += "/#{namespace}" if namespace
|
39
|
+
prefix += "/#{namespace}" if namespace && !namespace.empty?
|
40
40
|
prefix
|
41
41
|
end
|
42
42
|
|
@@ -44,7 +44,9 @@ module Openwsman
|
|
44
44
|
def self.epr_uri_for namespace, classname
|
45
45
|
raise "Namespace must not be nil" unless namespace
|
46
46
|
raise "Classname must not be nil" unless classname
|
47
|
-
"#{self.epr_prefix_for(classname)}
|
47
|
+
epr = "#{self.epr_prefix_for(classname)}"
|
48
|
+
epr << "/#{namespace}" unless namespace.empty?
|
49
|
+
epr << "/#{classname}"
|
48
50
|
end
|
49
51
|
|
50
52
|
class EndPointReference
|
metadata
CHANGED
@@ -1,93 +1,126 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: openwsman
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 3
|
9
|
+
- 4
|
10
|
+
version: 2.3.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Klaus
|
12
|
+
authors:
|
13
|
+
- "Klaus K\xC3\xA4mpf"
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-05-28 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: rake-compiler
|
16
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
25
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
22
33
|
type: :development
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
26
36
|
name: mocha
|
27
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 25
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 9
|
47
|
+
version: "0.9"
|
33
48
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
37
51
|
name: yard
|
38
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
54
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 1
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
- 5
|
62
|
+
version: "0.5"
|
44
63
|
type: :development
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
email:
|
64
|
+
version_requirements: *id003
|
65
|
+
description: |-
|
66
|
+
The openwsman gem provides a Ruby API to manage
|
67
|
+
systems using the WS-Management protocol.
|
68
|
+
email:
|
51
69
|
- kkaempf@suse.de
|
52
70
|
executables: []
|
53
|
-
|
71
|
+
|
72
|
+
extensions:
|
54
73
|
- ext/openwsman/extconf.rb
|
55
74
|
extra_rdoc_files: []
|
56
|
-
|
75
|
+
|
76
|
+
files:
|
57
77
|
- lib/openwsman.rb
|
58
|
-
- lib/openwsman/xmlnode.rb
|
59
|
-
- lib/openwsman/xmldoc.rb
|
60
78
|
- lib/openwsman/openwsman.rb
|
61
79
|
- lib/openwsman/version.rb
|
62
|
-
-
|
80
|
+
- lib/openwsman/xmlnode.rb
|
81
|
+
- lib/openwsman/xmldoc.rb
|
63
82
|
- ext/ruby/helpers.h
|
83
|
+
- ext/openwsman/openwsman.h
|
64
84
|
- ext/openwsman/openwsman_wrap.c
|
65
85
|
- ext/openwsman/openwsman.c
|
66
86
|
- ext/openwsman/extconf.rb
|
87
|
+
has_rdoc: true
|
67
88
|
homepage: http://www.github.com/openwsman/openwsman
|
68
89
|
licenses: []
|
69
|
-
|
70
|
-
|
90
|
+
|
91
|
+
post_install_message: " ____\n\
|
92
|
+
/@ ~-.\n\
|
93
|
+
/ __ .- | remember to have fun! \n // // @ \n\n"
|
71
94
|
rdoc_options: []
|
72
|
-
|
95
|
+
|
96
|
+
require_paths:
|
73
97
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
99
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
108
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 23
|
113
|
+
segments:
|
114
|
+
- 1
|
115
|
+
- 3
|
116
|
+
- 6
|
85
117
|
version: 1.3.6
|
86
118
|
requirements: []
|
119
|
+
|
87
120
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.5.0
|
89
122
|
signing_key:
|
90
123
|
specification_version: 3
|
91
124
|
summary: Ruby client bindings for Openwsman
|
92
125
|
test_files: []
|
93
|
-
|
126
|
+
|