sfcc 0.1.0 → 0.1.1
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/CHANGELOG.rdoc +6 -0
 - data/README.rdoc +6 -0
 - data/ext/sfcc/cim_client.c +28 -38
 - data/ext/sfcc/sfcc.c +13 -14
 - data/lib/sfcc.rb +1 -1
 - data/test/test_sfcc_cim_client.rb +13 -0
 - metadata +25 -4
 
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    
    
        data/ext/sfcc/cim_client.c
    CHANGED
    
    | 
         @@ -32,7 +32,7 @@ static VALUE get_class(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       32 
32 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       33 
33 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 35 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       36 
36 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       37 
37 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       38 
38 
     | 
    
         
             
              CMPIConstClass *cimclass = NULL;
         
     | 
| 
         @@ -43,7 +43,6 @@ static VALUE get_class(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       47 
46 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       48 
47 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       49 
48 
     | 
    
         | 
| 
         @@ -51,11 +50,13 @@ static VALUE get_class(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       51 
50 
     | 
    
         
             
              cimclass = client->ft->getClass(client, op, NUM2INT(flags), props, &status);
         
     | 
| 
       52 
51 
     | 
    
         
             
              free(props);
         
     | 
| 
       53 
52 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
               
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
               
     | 
| 
      
 53 
     | 
    
         
            +
              if (!status.rc) {
         
     | 
| 
      
 54 
     | 
    
         
            +
                  cimclassnew = cimclass->ft->clone(cimclass, NULL);
         
     | 
| 
      
 55 
     | 
    
         
            +
                  cimclass->ft->release(cimclass);
         
     | 
| 
      
 56 
     | 
    
         
            +
                  return Sfcc_wrap_cim_class(cimclassnew);
         
     | 
| 
      
 57 
     | 
    
         
            +
              }
         
     | 
| 
      
 58 
     | 
    
         
            +
              sfcc_rb_raise_if_error(status, "Can't get class at %s", CMGetCharsPtr(CMObjectPathToString(op, NULL), NULL));
         
     | 
| 
      
 59 
     | 
    
         
            +
              return Qnil;
         
     | 
| 
       59 
60 
     | 
    
         
             
            }
         
     | 
| 
       60 
61 
     | 
    
         | 
| 
       61 
62 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -70,7 +71,7 @@ static VALUE class_names(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       70 
71 
     | 
    
         
             
              VALUE object_path;
         
     | 
| 
       71 
72 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       72 
73 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 74 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       74 
75 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       75 
76 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       76 
77 
     | 
    
         
             
              VALUE rbenm = Qnil;
         
     | 
| 
         @@ -78,7 +79,6 @@ static VALUE class_names(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       78 
79 
     | 
    
         
             
              rb_scan_args(argc, argv, "11", &object_path, &flags);
         
     | 
| 
       79 
80 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       80 
81 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       82 
82 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       83 
83 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
         @@ -108,7 +108,7 @@ static VALUE classes(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       108 
108 
     | 
    
         
             
              VALUE object_path;
         
     | 
| 
       109 
109 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       110 
110 
     | 
    
         | 
| 
       111 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 111 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       112 
112 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       113 
113 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       114 
114 
     | 
    
         
             
              VALUE rbenm = Qnil;
         
     | 
| 
         @@ -116,7 +116,6 @@ static VALUE classes(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       116 
116 
     | 
    
         
             
              rb_scan_args(argc, argv, "11", &object_path, &flags);
         
     | 
| 
       117 
117 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       120 
119 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       121 
120 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       122 
121 
     | 
    
         | 
| 
         @@ -154,7 +153,7 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       154 
153 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       155 
154 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       156 
155 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 156 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       158 
157 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       159 
158 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       160 
159 
     | 
    
         
             
              CMPIInstance *ciminstance = NULL;
         
     | 
| 
         @@ -163,7 +162,6 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       163 
162 
     | 
    
         
             
              rb_scan_args(argc, argv, "12", &object_path, &flags, &properties);
         
     | 
| 
       164 
163 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       165 
164 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       167 
165 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       168 
166 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       169 
167 
     | 
    
         | 
| 
         @@ -193,7 +191,7 @@ static VALUE get_instance(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       193 
191 
     | 
    
         
             
             */
         
     | 
| 
       194 
192 
     | 
    
         
             
            static VALUE create_instance(VALUE self, VALUE object_path, VALUE instance)
         
     | 
| 
       195 
193 
     | 
    
         
             
            {
         
     | 
| 
       196 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 194 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       197 
195 
     | 
    
         
             
              CMCIClient *ptr = NULL;
         
     | 
| 
       198 
196 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       199 
197 
     | 
    
         
             
              CMPIObjectPath *new_op = NULL;
         
     | 
| 
         @@ -233,7 +231,7 @@ static VALUE set_instance(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       233 
231 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       234 
232 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       235 
233 
     | 
    
         | 
| 
       236 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 234 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       237 
235 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       238 
236 
     | 
    
         
             
              CMPIInstance *inst = NULL;
         
     | 
| 
       239 
237 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
         @@ -264,7 +262,7 @@ static VALUE set_instance(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       264 
262 
     | 
    
         
             
             */
         
     | 
| 
       265 
263 
     | 
    
         
             
            static VALUE delete_instance(VALUE self, VALUE object_path)
         
     | 
| 
       266 
264 
     | 
    
         
             
            {
         
     | 
| 
       267 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 265 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       268 
266 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       269 
267 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       270 
268 
     | 
    
         | 
| 
         @@ -296,11 +294,10 @@ static VALUE query(VALUE self, 
     | 
|
| 
       296 
294 
     | 
    
         
             
                               VALUE query,
         
     | 
| 
       297 
295 
     | 
    
         
             
                               VALUE lang)
         
     | 
| 
       298 
296 
     | 
    
         
             
            {
         
     | 
| 
       299 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 297 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       300 
298 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       301 
299 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       302 
300 
     | 
    
         | 
| 
       303 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       304 
301 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       305 
302 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       306 
303 
     | 
    
         
             
              VALUE rbenm = Qnil;
         
     | 
| 
         @@ -328,12 +325,11 @@ static VALUE query(VALUE self, 
     | 
|
| 
       328 
325 
     | 
    
         
             
             */
         
     | 
| 
       329 
326 
     | 
    
         
             
            static VALUE instance_names(VALUE self, VALUE object_path)
         
     | 
| 
       330 
327 
     | 
    
         
             
            {
         
     | 
| 
       331 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 328 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       332 
329 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       333 
330 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       334 
331 
     | 
    
         
             
              VALUE rbenm = Qnil;
         
     | 
| 
       335 
332 
     | 
    
         | 
| 
       336 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       337 
333 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       338 
334 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       339 
335 
     | 
    
         | 
| 
         @@ -372,7 +368,7 @@ static VALUE instances(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       372 
368 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       373 
369 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       374 
370 
     | 
    
         | 
| 
       375 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 371 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       376 
372 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       377 
373 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       378 
374 
     | 
    
         
             
              char **props;
         
     | 
| 
         @@ -381,7 +377,6 @@ static VALUE instances(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       381 
377 
     | 
    
         
             
              rb_scan_args(argc, argv, "12", &object_path, &flags, &properties);
         
     | 
| 
       382 
378 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       383 
379 
     | 
    
         | 
| 
       384 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       385 
380 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       386 
381 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       387 
382 
     | 
    
         | 
| 
         @@ -455,7 +450,7 @@ static VALUE associators(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       455 
450 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       456 
451 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       457 
452 
     | 
    
         | 
| 
       458 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 453 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       459 
454 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       460 
455 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       461 
456 
     | 
    
         
             
              char **props;
         
     | 
| 
         @@ -467,7 +462,6 @@ static VALUE associators(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       467 
462 
     | 
    
         
             
                           &role, &result_role, &flags, &properties);
         
     | 
| 
       468 
463 
     | 
    
         | 
| 
       469 
464 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       470 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       471 
465 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       472 
466 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       473 
467 
     | 
    
         | 
| 
         @@ -537,7 +531,7 @@ static VALUE associator_names(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       537 
531 
     | 
    
         
             
              VALUE role;
         
     | 
| 
       538 
532 
     | 
    
         
             
              VALUE result_role;
         
     | 
| 
       539 
533 
     | 
    
         | 
| 
       540 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 534 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       541 
535 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       542 
536 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       543 
537 
     | 
    
         
             
              CMPIEnumeration *enm = NULL;
         
     | 
| 
         @@ -547,7 +541,6 @@ static VALUE associator_names(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       547 
541 
     | 
    
         
             
                           &assoc_class, &result_class,
         
     | 
| 
       548 
542 
     | 
    
         
             
                           &role, &result_role);
         
     | 
| 
       549 
543 
     | 
    
         | 
| 
       550 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       551 
544 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       552 
545 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       553 
546 
     | 
    
         | 
| 
         @@ -605,7 +598,7 @@ static VALUE references(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       605 
598 
     | 
    
         
             
              VALUE flags;
         
     | 
| 
       606 
599 
     | 
    
         
             
              VALUE properties;
         
     | 
| 
       607 
600 
     | 
    
         | 
| 
       608 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 601 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       609 
602 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       610 
603 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       611 
604 
     | 
    
         
             
              char **props;
         
     | 
| 
         @@ -617,7 +610,6 @@ static VALUE references(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       617 
610 
     | 
    
         
             
                           &flags, &properties);
         
     | 
| 
       618 
611 
     | 
    
         | 
| 
       619 
612 
     | 
    
         
             
              if (NIL_P(flags)) flags = INT2NUM(0);
         
     | 
| 
       620 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       621 
613 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       622 
614 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       623 
615 
     | 
    
         | 
| 
         @@ -666,17 +658,16 @@ static VALUE reference_names(int argc, VALUE *argv, VALUE self) 
     | 
|
| 
       666 
658 
     | 
    
         
             
              VALUE object_path = Qnil;
         
     | 
| 
       667 
659 
     | 
    
         
             
              VALUE result_class = Qnil;
         
     | 
| 
       668 
660 
     | 
    
         
             
              VALUE role = Qnil;
         
     | 
| 
       669 
     | 
    
         
            -
             
     | 
| 
       670 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 661 
     | 
    
         
            +
              
         
     | 
| 
      
 662 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       671 
663 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       672 
664 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       673 
665 
     | 
    
         
             
              CMPIEnumeration *enm = NULL;
         
     | 
| 
       674 
666 
     | 
    
         
             
              VALUE rbenm = Qnil;
         
     | 
| 
       675 
667 
     | 
    
         | 
| 
       676 
     | 
    
         
            -
              rb_scan_args(argc, argv, " 
     | 
| 
      
 668 
     | 
    
         
            +
              rb_scan_args(argc, argv, "12", &object_path,
         
     | 
| 
       677 
669 
     | 
    
         
             
                           &result_class, &role);
         
     | 
| 
       678 
670 
     | 
    
         | 
| 
       679 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       680 
671 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, client);
         
     | 
| 
       681 
672 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       682 
673 
     | 
    
         | 
| 
         @@ -714,7 +705,7 @@ static VALUE invoke_method(VALUE self, 
     | 
|
| 
       714 
705 
     | 
    
         
             
                                       VALUE argin,
         
     | 
| 
       715 
706 
     | 
    
         
             
                                       VALUE argout)
         
     | 
| 
       716 
707 
     | 
    
         
             
            {
         
     | 
| 
       717 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 708 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       718 
709 
     | 
    
         
             
              CMCIClient *ptr = NULL;
         
     | 
| 
       719 
710 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       720 
711 
     | 
    
         
             
              CMPIArgs *cmpiargsout;
         
     | 
| 
         @@ -722,7 +713,6 @@ static VALUE invoke_method(VALUE self, 
     | 
|
| 
       722 
713 
     | 
    
         
             
              char *method_name_cstr;
         
     | 
| 
       723 
714 
     | 
    
         
             
              CMPIData ret;
         
     | 
| 
       724 
715 
     | 
    
         
             
              Check_Type(argin, T_HASH);
         
     | 
| 
       725 
     | 
    
         
            -
              memset(&status, 0, sizeof(CMPIStatus));
         
     | 
| 
       726 
716 
     | 
    
         | 
| 
       727 
717 
     | 
    
         
             
              cmpiargsout = newCMPIArgs(NULL);
         
     | 
| 
       728 
718 
     | 
    
         | 
| 
         @@ -763,7 +753,7 @@ static VALUE set_property(VALUE self, 
     | 
|
| 
       763 
753 
     | 
    
         
             
                                      VALUE name,
         
     | 
| 
       764 
754 
     | 
    
         
             
                                      VALUE value)
         
     | 
| 
       765 
755 
     | 
    
         
             
            {
         
     | 
| 
       766 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 756 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       767 
757 
     | 
    
         
             
              CMCIClient *ptr = NULL;
         
     | 
| 
       768 
758 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       769 
759 
     | 
    
         
             
              CMPIData data;
         
     | 
| 
         @@ -792,9 +782,9 @@ static VALUE property(VALUE self, VALUE object_path, VALUE name) 
     | 
|
| 
       792 
782 
     | 
    
         
             
            {
         
     | 
| 
       793 
783 
     | 
    
         
             
              CMCIClient *ptr = NULL;
         
     | 
| 
       794 
784 
     | 
    
         
             
              CMPIObjectPath *op = NULL;
         
     | 
| 
       795 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 785 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       796 
786 
     | 
    
         
             
              CMPIData data;
         
     | 
| 
       797 
     | 
    
         
            -
             
     | 
| 
      
 787 
     | 
    
         
            +
             
     | 
| 
       798 
788 
     | 
    
         
             
              Data_Get_Struct(self, CMCIClient, ptr);
         
     | 
| 
       799 
789 
     | 
    
         
             
              Data_Get_Struct(object_path, CMPIObjectPath, op);
         
     | 
| 
       800 
790 
     | 
    
         
             
              data = ptr->ft->getProperty(ptr, op, StringValuePtr(name), &status);
         
     | 
| 
         @@ -808,7 +798,7 @@ static VALUE property(VALUE self, VALUE object_path, VALUE name) 
     | 
|
| 
       808 
798 
     | 
    
         
             
            static VALUE connect(VALUE klass, VALUE host, VALUE scheme, VALUE port, VALUE user, VALUE pwd)
         
     | 
| 
       809 
799 
     | 
    
         
             
            {
         
     | 
| 
       810 
800 
     | 
    
         
             
              CMCIClient *client = NULL;
         
     | 
| 
       811 
     | 
    
         
            -
              CMPIStatus status;
         
     | 
| 
      
 801 
     | 
    
         
            +
              CMPIStatus status = {CMPI_RC_OK, NULL};
         
     | 
| 
       812 
802 
     | 
    
         
             
              client = cmciConnect(NIL_P(host) ? NULL : StringValuePtr(host),
         
     | 
| 
       813 
803 
     | 
    
         
             
                                   NIL_P(scheme) ? NULL : StringValuePtr(scheme),
         
     | 
| 
       814 
804 
     | 
    
         
             
                                   NIL_P(port) ? NULL : StringValuePtr(port),
         
     | 
    
        data/ext/sfcc/sfcc.c
    CHANGED
    
    | 
         @@ -88,28 +88,27 @@ static VALUE sfcc_status_exception(CMPIStatus status) 
     | 
|
| 
       88 
88 
     | 
    
         
             
              }
         
     | 
| 
       89 
89 
     | 
    
         
             
            }
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
      
 91 
     | 
    
         
            +
            #define MAX_ERROR_BUFFER 255
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       91 
93 
     | 
    
         
             
            void sfcc_rb_raise_if_error(CMPIStatus status, const char *msg, ...)
         
     | 
| 
       92 
94 
     | 
    
         
             
            {
         
     | 
| 
       93 
     | 
    
         
            -
              static char *error_separator = " : ";
         
     | 
| 
       94 
95 
     | 
    
         
             
              va_list arg_list;
         
     | 
| 
       95 
     | 
    
         
            -
               
     | 
| 
       96 
     | 
    
         
            -
               
     | 
| 
       97 
     | 
    
         
            -
              char *error = NULL;
         
     | 
| 
      
 96 
     | 
    
         
            +
              char orig_error[MAX_ERROR_BUFFER];
         
     | 
| 
      
 97 
     | 
    
         
            +
              char error[MAX_ERROR_BUFFER];
         
     | 
| 
       98 
98 
     | 
    
         | 
| 
       99 
99 
     | 
    
         
             
              if (!status.rc)
         
     | 
| 
       100 
100 
     | 
    
         
             
                return;
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
               
     | 
| 
      
 102 
     | 
    
         
            +
              va_start(arg_list, msg);
         
     | 
| 
      
 103 
     | 
    
         
            +
              vsnprintf(orig_error, MAX_ERROR_BUFFER, msg, arg_list);
         
     | 
| 
      
 104 
     | 
    
         
            +
              va_end(arg_list);
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
       103 
106 
     | 
    
         
             
              if (status.msg)
         
     | 
| 
       104 
     | 
    
         
            -
                 
     | 
| 
       105 
     | 
    
         
            -
               
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                strcat(error, status.msg->ft->getCharPtr(status.msg, NULL));
         
     | 
| 
       110 
     | 
    
         
            -
              }
         
     | 
| 
       111 
     | 
    
         
            -
              rb_raise(sfcc_status_exception(status), error, arg_list);
         
     | 
| 
       112 
     | 
    
         
            -
              free(error);
         
     | 
| 
      
 107 
     | 
    
         
            +
                snprintf(error, MAX_ERROR_BUFFER, "%s : %s", orig_error, status.msg->ft->getCharPtr(status.msg, NULL));
         
     | 
| 
      
 108 
     | 
    
         
            +
              else
         
     | 
| 
      
 109 
     | 
    
         
            +
                strcpy(error, orig_error);
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
              rb_raise(sfcc_status_exception(status), error);
         
     | 
| 
       113 
112 
     | 
    
         
             
            }
         
     | 
| 
       114 
113 
     | 
    
         | 
| 
       115 
114 
     | 
    
         
             
            char ** sfcc_value_array_to_string_array(VALUE array)
         
     | 
    
        data/lib/sfcc.rb
    CHANGED
    
    
| 
         @@ -33,6 +33,19 @@ class SfccCimcClient < SfccTestCase 
     | 
|
| 
       33 
33 
     | 
    
         
             
                  end
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
      
 36 
     | 
    
         
            +
                should "be able to get a class from the object path" do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @op = Sfcc::Cim::ObjectPath.new("root/cimv2", "Linux_OperatingSystem")
         
     | 
| 
      
 38 
     | 
    
         
            +
                  cimclass = @client.get_class(@op)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  assert_kind_of Sfcc::Cim::Class, cimclass
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                should "report error when getting invalid class" do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  @op = Sfcc::Cim::ObjectPath.new("root/cimv2", "NotExistingClass")
         
     | 
| 
      
 44 
     | 
    
         
            +
                  assert_raise Sfcc::Cim::ErrorNotFound do
         
     | 
| 
      
 45 
     | 
    
         
            +
                    cimclass = @client.get_class(@op)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
                
         
     | 
| 
       36 
49 
     | 
    
         
             
                should "be able to get an instance from the object path" do
         
     | 
| 
       37 
50 
     | 
    
         
             
                  @op = Sfcc::Cim::ObjectPath.new("root/cimv2", "Linux_OperatingSystem")
         
     | 
| 
       38 
51 
     | 
    
         
             
                  instance = @client.query(@op, "select * from Linux_OperatingSystem", "wql").to_a.first
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sfcc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Duncan Mac-Vicar P.
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2010-01- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2010-01-18 00:00:00 +01:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -52,6 +52,26 @@ dependencies: 
     | 
|
| 
       52 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       53 
53 
     | 
    
         
             
                    version: 0.3.0
         
     | 
| 
       54 
54 
     | 
    
         
             
                version: 
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: yard
         
     | 
| 
      
 57 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 58 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 59 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 60 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 61 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 62 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 63 
     | 
    
         
            +
                    version: 0.5.3
         
     | 
| 
      
 64 
     | 
    
         
            +
                version: 
         
     | 
| 
      
 65 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 66 
     | 
    
         
            +
              name: hoe-yard
         
     | 
| 
      
 67 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirement: 
         
     | 
| 
      
 69 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 70 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 71 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 72 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 73 
     | 
    
         
            +
                    version: 0.1.1
         
     | 
| 
      
 74 
     | 
    
         
            +
                version: 
         
     | 
| 
       55 
75 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       56 
76 
     | 
    
         
             
              name: rake-compiler
         
     | 
| 
       57 
77 
     | 
    
         
             
              type: :development
         
     | 
| 
         @@ -119,8 +139,9 @@ licenses: [] 
     | 
|
| 
       119 
139 
     | 
    
         | 
| 
       120 
140 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       121 
141 
     | 
    
         
             
            rdoc_options: 
         
     | 
| 
       122 
     | 
    
         
            -
            - -- 
     | 
| 
       123 
     | 
    
         
            -
            -  
     | 
| 
      
 142 
     | 
    
         
            +
            - --title
         
     | 
| 
      
 143 
     | 
    
         
            +
            - Sfcc Documentation
         
     | 
| 
      
 144 
     | 
    
         
            +
            - --quiet
         
     | 
| 
       124 
145 
     | 
    
         
             
            require_paths: 
         
     | 
| 
       125 
146 
     | 
    
         
             
            - lib
         
     | 
| 
       126 
147 
     | 
    
         
             
            - ext
         
     |