Skip to content

Commit

Permalink
Merge pull request #24 from jdsn/master
Browse files Browse the repository at this point in the history
Cherry-pick from Code-11-SP3 to master, on behalf of fate#312712
  • Loading branch information
tgoettlicher committed Nov 19, 2012
2 parents 5387171 + 0933f85 commit d5c949e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/modules/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SUBDIRS = . testsuite

module_DATA = MailTableInclude.pm MailTable.pm $(wildcard *.ycp)
module_DATA = MailTableInclude.pm MailTable.pm $(wildcard *.ycp) $(wildcard *.pm)
EXTRA_DIST = $(module_DATA) Version.ycp.in

YCPCFLAGS = -M ../types/src
Expand Down
69 changes: 69 additions & 0 deletions library/modules/RegistrationStatus.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Copyright (c) 2011 Novell, Inc.
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#

package RegistrationStatus;

use strict;
use Data::Dumper;
use XML::Simple;

use YaST::YCP qw(:DATA :LOGGING);

our %TYPEINFO;

# see https://wiki.innerweb.novell.com/index.php/Registration#Add_Registration_Status_to_zmdconfig
# for more datils about the file format
my $reg_file = "/var/lib/suseRegister/registration-status.xml";

# return the default registration status file name
BEGIN{ $TYPEINFO{RegFile} = ["function", "string"]; }
sub RegFile {
my ($self) = @_;
return $reg_file;
}

# parse the default registration XML status file
BEGIN{ $TYPEINFO{Read} = ["function", ["map","any","any"]]; }
sub Read {
my ($self) = @_;
return ReadFile($reg_file);
}

# parse the requested registration XML status file, convert the XML file into a map
BEGIN{ $TYPEINFO{ReadFile} = ["function", ["map","any","any"], "string"]; }
sub ReadFile {
my $self = shift;
my $file = shift;

# create XML parser
my $parser = new XML::Simple;

# parse the file
my $data = $parser->XMLin($file);

my $dump = Dumper($data);
y2milestone("Parsed file $file: $dump");

return $data;
}

1

2 changes: 1 addition & 1 deletion yast2.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Requires: coreutils sysconfig
Requires: yast2-xml yast2-hardware-detection
# for SLPAPI.pm
Requires: yast2-perl-bindings
# for ag_anyxml
# for ag_anyxml, RegistrationStatus.pm
Requires: perl-XML-Simple
# for GPG.ycp
Requires: gpg2
Expand Down

0 comments on commit d5c949e

Please sign in to comment.