Description of problem: spacewalk-api returns this "bless( do{\(my $o = '0')}, 'Frontier::RPC2::Boolean')" instead of a boolean value. Version-Release number of selected component (if applicable): Sat5.7 Sat5.6 How reproducible: 100% Steps to Reproduce: > spacewalk-api --server localhost --user=admin --password=xxx user.listUsers %session% Actual results: $result = [ { 'login_uc' => 'ADMIN', 'id' => '1', 'enabled' => bless( do{\(my $o = '1')}, 'Frontier::RPC2::Boolean' ), 'login' => 'admin' }, { 'login_uc' => 'TEST', 'id' => '3', 'enabled' => bless( do{\(my $o = '1')}, 'Frontier::RPC2::Boolean' ), 'login' => 'test' } ]; Expected results: $result = [ { 'login_uc' => 'ADMIN', 'id' => '1', 'enabled' => true, 'login' => 'admin' }, { 'login_uc' => 'TEST', 'id' => '3', 'enabled' => true, 'login' => 'test' } ]; or > spacewalk-api --server localhost --user=xxx --password=nimda user.getDetails %session% "admin" Actual results: $result = { 'first_names' => 'Admin', 'last_login_date' => '10/23/14 6:45:31 AM EDT', 'org_name' => 'Red Hat SatTeam QA', 'use_pam' => bless( do{\(my $o = '0')}, 'Frontier::RPC2::Boolean' ), 'created_date' => '10/20/14 4:02:16 AM EDT', 'last_name' => 'Admin', 'email' => 'root@localhost', 'org_id' => '1', 'read_only' => bless( do{\(my $o = '0')}, 'Frontier::RPC2::Boolean' ), 'errata_notification' => bless( do{\(my $o = '1')}, 'Frontier::RPC2::Boolean' ), 'first_name' => 'Admin', 'enabled' => bless( do{\(my $o = '1')}, 'Frontier::RPC2::Boolean' ), 'prefix' => 'Mr.' }; Expected results: $result = { 'first_names' => 'Admin', 'last_login_date' => '10/23/14 6:45:31 AM EDT', 'org_name' => 'Red Hat SatTeam QA', 'use_pam' => true, 'created_date' => '10/20/14 4:02:16 AM EDT', 'last_name' => 'Admin', 'email' => 'root@localhost', 'org_id' => '1', 'read_only' => true, 'errata_notification' => true, 'first_name' => 'Admin', 'enabled' => true, 'prefix' => 'Mr.' }; Additional info:
*** Bug 1182925 has been marked as a duplicate of this bug. ***
The same case, but with date Satellite-5.6.0-RHEL6-re20130927.0 (spacewalk-utils-2.0.2-22.el6sat) 'last_modified' => bless( do{\(my $o = '20131129T04:52:54')}, 'Frontier::RPC2::DateTime::ISO8601' ), Reproducer: spacewalk-api --server=localhost packages.findByNvrea %session% dracut %string:004% 336.el6_5.2 %string:% noarch Enter username: admin Enter your password: $result = [ { 'provider' => 'Red Hat Inc.', 'arch_label' => 'noarch', 'epoch' => '', 'version' => '004', 'last_modified' => bless( do{\(my $o = '20131129T04:52:54')}, 'Frontier::RPC2::DateTime::ISO8601' ), 'name' => 'dracut', 'path' => 'redhat/NULL/8ef/dracut/004-336.el6_5.2/noarch/8efa046b792fc482fea261d7ba594002454568a16beceeda74b24a95071f8900/dracut-004-336.el6_5.2.noarch.rpm', 'release' => '336.el6_5.2', 'id' => '13176' } ];
Investigation showed this: Data types of values returned in API structures depend on their data type declaration (Java part). See API documentation for detailed information about input/output data types. Perl doesn't support data types such as Boolean, DateTime... and there was not written automatic converter of these Frontier::RPC2 types to Perl types (numbers, strings). There are of course ways in Perl, which allow us: - to detect if the object reference ($ref) is blessed (Scalar::Util->blessed($ref)), - to check if object reference is able to call method value() (UNIVERSAL::can($ref, "value")), - to return value of the blessed object reference ($ref->value()) But to do this additionally in returned data is very inefficient due to need of iteration through the whole data structure which can be theoretically huge. Let me know if any questions please
I do not see any code changes, so I'm switching the BZ back to NEW.
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog. This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED. Closing now to help set customer expectations as early as possible. You are welcome to re-open this bug if needed.