Hello community,

here is the log from the commit of package caasp-tools for openSUSE:Factory 
checked in at 2017-04-18 13:48:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/caasp-tools (Old)
 and      /work/SRC/openSUSE:Factory/.caasp-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "caasp-tools"

Tue Apr 18 13:48:35 2017 rev:1 rq:478457 version:0.13

Changes:
--------
New Changes file:

--- /dev/null   2017-03-01 00:40:19.279048016 +0100
+++ /work/SRC/openSUSE:Factory/.caasp-tools.new/caasp-tools.changes     
2017-04-18 13:48:35.741778535 +0200
@@ -0,0 +1,93 @@
+-------------------------------------------------------------------
+Thu Feb 16 18:07:35 CET 2017 - ku...@suse.de
+
+- Remove enabling services workaround
+
+-------------------------------------------------------------------
+Mon Feb 13 14:02:48 CET 2017 - ku...@suse.de
+
+- Fix typo in spec file
+
+-------------------------------------------------------------------
+Fri Feb 10 15:11:19 CET 2017 - ku...@suse.de
+
+- Add manual page for create_autoyast_profile
+- Add script to generate /etc/fstab.sys (mount overlayfs in initrd)
+
+-------------------------------------------------------------------
+Wed Feb  1 18:02:31 CET 2017 - ku...@suse.de
+
+- Add workarounds to configure and enable salt-minion in autoyast
+  profile
+
+-------------------------------------------------------------------
+Sun Jan 29 21:52:49 UTC 2017 - ku...@suse.de
+
+- Parse SUSEConnnect -s output for registration information
+
+-------------------------------------------------------------------
+Sun Jan 29 13:51:20 CET 2017 - ku...@suse.de
+
+- Disable installer self update in autoyast profile
+
+-------------------------------------------------------------------
+Fri Jan 20 21:19:39 CET 2017 - ku...@suse.de
+
+- Adjust for openSUSE support
+
+-------------------------------------------------------------------
+Fri Jan 20 12:14:53 CET 2017 - ku...@suse.de
+
+- Replace autoyast profile with script to create it manual
+
+-------------------------------------------------------------------
+Sat Jan 14 10:31:06 CET 2017 - ku...@suse.de
+
+- Add autoyast profile caasp.xml 
+
+-------------------------------------------------------------------
+Sat Jan 14 10:28:02 CET 2017 - ku...@suse.de
+
+- Rename from casp to caasp
+
+-------------------------------------------------------------------
+Mon Dec 19 15:28:28 CET 2016 - ku...@suse.de
+
+- Set "hostonly=''" for including overlay kernel module
+  [bnc#1016007]
+
+-------------------------------------------------------------------
+Wed Dec 14 11:44:21 CET 2016 - ku...@suse.de
+
+- Replace hardcoded device with current root device
+
+-------------------------------------------------------------------
+Tue Nov 22 17:24:04 CET 2016 - ku...@suse.de
+
+- Move cloud.cfg into own RPM
+
+-------------------------------------------------------------------
+Mon Nov 21 19:24:44 CET 2016 - ku...@suse.de
+
+- Rename "stateless" to "overlay", which fits better from the name
+
+-------------------------------------------------------------------
+Tue Nov 15 13:12:53 CET 2016 - ku...@suse.de
+
+- Move systemd presets to own package
+
+-------------------------------------------------------------------
+Sun Nov 13 17:40:16 CET 2016 - ku...@suse.de
+
+- Update cloud.cfg
+
+-------------------------------------------------------------------
+Sun Nov 13 10:55:45 CET 2016 - ku...@suse.de
+
+- Enable logrotate.timer per default
+
+-------------------------------------------------------------------
+Mon Oct 24 15:02:01 CEST 2016 - ku...@suse.de
+
+- Initial version with new name
+

New:
----
  MicroOS-tools-0.13.tar.bz2
  caasp-tools.changes
  caasp-tools.spec
  create_autoyast_profile.pl

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ caasp-tools.spec ++++++
#
# spec file for package caasp-tools
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           caasp-tools
Version:        0.13
Release:        0
Summary:        Files and Scripts for SUSE CaaS Platform
License:        GPL-2.0+
Group:          Development/Tools/Other
Source0:        MicroOS-tools-%{version}.tar.bz2
Source1:        create_autoyast_profile.pl
BuildRequires:  distribution-release
BuildRequires:  dracut
BuildRequires:  snapper
BuildRequires:  systemd
BuildRequires:  udev
Requires:       perl-JSON
#only needed as directory owners
# Requires:       distribution-release systemd udev
Requires:       util-linux
Requires(post): awk
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Files, scripts and directories for SUSE Containers as a Service Platform.

%prep
%setup -q -n MicroOS-tools-%{version}

%build

%install
cp -a * %{buildroot}
mkdir -p %{buildroot}%{_sbindir}
install %{SOURCE1} %{buildroot}%{_sbindir}/create_autoyast_profile
mkdir -p %{buildroot}%{_localstatedir}/adm/netconfig
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/etc
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-etc
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/netconfig
mkdir -p %{buildroot}%{_localstatedir}/lib/overlay/work-netconfig
mkdir -p %{buildroot}%{_mandir}/man8
pod2man %{SOURCE1} > %{buildroot}%{_mandir}/man8/create_autoyast_profile.8

%post
if [ -f /etc/fstab -a ! -f /etc/fstab.sys ]; then
  /usr/sbin/setup-fstab.sys-for-overlayfs ||:
fi
exit 0

%files
%defattr(-,root,root)
%config %{_sysconfdir}/systemd/system/systemd-firstboot.service
%{_unitdir}
%{_libexecdir}/MicroOS-firstboot
%{_sbindir}/create_autoyast_profile
%{_sbindir}/setup-fstab.sys-for-overlayfs
%{_mandir}/man8/create_autoyast_profile.8*
%{_localstatedir}/lib/overlay
%dir %{_localstatedir}/adm/netconfig
%{_prefix}/lib/dracut/modules.d/99SUSE_MicroOS

%changelog
++++++ create_autoyast_profile.pl ++++++
#!/usr/bin/perl
#
# Copyright (C) 2017 Thorsten Kukuk
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# in Version 2 or later 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, see <http://www.gnu.org/licenses/>. */
#

=head1 NAME

    create_autoyast_profile - Create autoyast profile for CaaSP

=head1 SYNOPSIS

    create_autoyast_profile [options]

=head1 DESCRIPTION

    Create an autoyast profile for fully automatic installation of
    SUSE Container as a Service Platform Worker.

=head1 OPTIONS

    -o|--output file    Write autoyast profile as 'file' to disk
    --salt-master       Specify the name of the salt master server
    --smt-url           Specify url of SMT server
    --regcode           Specify registration code for SUSE CaaSP
    --reg-email         Specify email address for registration
    --usage             Print usage
    -h|-?|--help        Help

=cut

use strict;
use warnings;
use locale;
use Pod::Usage;
use Getopt::Long;
use Sys::Hostname;
use JSON qw(decode_json);

my $outputfile = "-";
my $saltmaster = hostname();
my $smturl = "";
my $reg_email = "";
my $regcode = "";
my $help = 0;
my $man = 0;
my $usage = 0;

GetOptions('o|output=s' => \$outputfile,
           'salt-master=s' => \$saltmaster,
           'smt-url=s' => \$smturl,
           'reg-email=s' => \$reg_email,
           'regcode=s' => \$regcode,
           'man' => \$man,
           'u|usage' => \$usage,
           'help|h|?' => \$help) or pod2usage(2);
pod2usage(0) if $help;
pod2usage(-exitstatus => 0, -verbose => 2) if $man;
pod2usage(-exitstatus => 0, -verbose => 0) if $usage;



open(OUTPUT,">$outputfile") || die("Can't open output file $outputfile: $!.");

print_header();
print_bootloader();
print_general_section();
print_languages();
setup_networking();
print_software();
print_services();
print_scripts();
set_root_password();
setup_registration();
setup_salt_minion();
print_footer();

close(OUTPUT);

#------------------------------------------------------------------------------

sub print_header {
    print OUTPUT <<"HeaderText";
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns"; 
xmlns:config="http://www.suse.com/1.0/configns";>
HeaderText
}

#------------------------------------------------------------------------------

sub print_footer {
    print OUTPUT <<"EOT";
</profile>
EOT
}

#------------------------------------------------------------------------------

sub print_bootloader {
    print OUTPUT <<"EOT";
  <bootloader>
    <global>
      <generic_mbr>true</generic_mbr>
      <gfxmode>auto</gfxmode>
      <hiddenmenu>false</hiddenmenu>
      <os_prober>false</os_prober>
      <terminal>gfxterm</terminal>
      <timeout config:type="integer">8</timeout>
      <suse_btrfs config:type="boolean">true</suse_btrfs>
    </global>
  </bootloader>
EOT
}

#------------------------------------------------------------------------------

sub print_general_section {
    print OUTPUT <<"EOT";
  <general>
    <ask-list config:type="list"/>
    <mode>
      <confirm config:type="boolean">false</confirm>
      <second_stage config:type="boolean">false</second_stage>
      <self_update config:type="boolean">false</self_update>
    </mode>
    <proposals config:type="list"/>
    <storage>
      <partition_alignment 
config:type="symbol">align_optimal</partition_alignment>
      <start_multipath config:type="boolean">false</start_multipath>
    </storage>
  </general>
   <partitioning config:type="list">
    <drive>
      <use>all</use>
    </drive>
  </partitioning>
  <ssh_import>
    <copy_config config:type="boolean">false</copy_config>
    <import config:type="boolean">false</import>
  </ssh_import>
EOT
}

#------------------------------------------------------------------------------

sub print_languages {
    print OUTPUT <<"EOT";
  <keyboard>
    <keymap>english-us</keymap>
  </keyboard>
  <language>
    <language>en_US</language>
    <languages/>
  </language>
  <timezone>
    <hwclock>UTC</hwclock>
    <timezone>Etc/GMT</timezone>
  </timezone>
EOT
}

#------------------------------------------------------------------------------

sub set_root_password {

    my $password = "!";
    my $encrypted = "true";

    open(PASSWD, '/etc/passwd');
    while (<PASSWD>) {
        chomp;
        my($login, $passwd, $uid, $gid, $gcos, $home, $shell) = split(/:/);

        if ($login eq "root") {
            if ($passwd eq "x") {
                if (open(SHADOW, '/etc/shadow')) {
                while (<SHADOW>) {
                    chomp;
                    my($slogin, $spasswd, $sp_lstchg, $sp_min, $sp_max,
                       $sp_warn, $sp_inact, $sp_expire, $sp_flag) = split(/:/);
                    if ($slogin eq "root") {
                        $password = $spasswd;
                        $encrypted = "true";
                    }
                }
                close(SHADOW);
                }
            } else {
                $password = $passwd;
            }
        }
    }
    close(PASSWD);

    print OUTPUT <<"EOT";
  <users config:type="list">
    <user>
      <username>root</username>
EOT

print OUTPUT "      <user_password>$password</user_password>\n";
print OUTPUT "      <encrypted 
config:type=\"boolean\">$encrypted</encrypted>\n";

    print OUTPUT <<"EOT"
    </user>
  </users>
EOT
}

#------------------------------------------------------------------------------

sub print_software {
    print OUTPUT <<"EOT";
  <software>
    <image/>
    <install_recommended config:type="boolean">false</install_recommended>
    <instsource/>
    <patterns config:type="list">
      <pattern>MicroOS</pattern>
    </patterns>
    <patterns config:type="list">
      <pattern>Stack</pattern>
    </patterns>
  </software>
EOT
}

#------------------------------------------------------------------------------

sub print_services {
    print OUTPUT <<"EOT";
  <services-manager>
    <default_target>multi-user</default_target>
    <services>
      <disable config:type="list">
        <service>purge-kernels</service>
      </disable>
      <enable config:type="list">
        <service>sshd</service>
        <service>cloud-init-local</service>
        <service>cloud-init</service>
        <service>cloud-config</service>
        <service>cloud-final</service>
        <service>issue-generator</service>
        <service>issue-add-ssh-keys</service>
EOT
    print OUTPUT "        <service>salt-minion</service>" if ($saltmaster ne 
"");
    print OUTPUT <<"EOT";
      </enable>
    </services>
  </services-manager>
EOT
}

#------------------------------------------------------------------------------

sub print_scripts {

    if ($saltmaster ne "") {
        print OUTPUT <<"EOT";
  <scripts>
    <chroot-scripts config:type="list">
      <script>
        <filename>configure-salt.sh</filename>
        <interpreter>shell</interpreter>
        <chrooted config:type="boolean">true</chrooted>
        <source>
<![CDATA[
#!/bin/sh
EOT
       print OUTPUT "echo \"master: $saltmaster\" > 
/etc/salt/minion.d/master.conf" if ($saltmaster ne "");
    print OUTPUT <<"EOT";
]]>
        </source>
      </script>
    </chroot-scripts>
  </scripts>
EOT
    }
}

#------------------------------------------------------------------------------

sub find_smturl {
    if (open(INPUTFILE, "</etc/SUSEConnect")) {
        while (<INPUTFILE>) {
            chomp;
            if ( $_ =~ m/^url:/ ) {
                $_ =~ s/url: //;
                close (INPUTFILE);
                return $_;
            }
        }
    }
    close (INPUTFILE);
    return "";
}

sub setup_registration {
    my $is_active = 0;

    if ($smturl ne "" || $regcode ne "") {
        $is_active = 1;
    } else {
        my $connectoutput = `/usr/sbin/SUSEConnect -s 2>/dev/null`;
        if ($? == 0) {
            my $decoded = decode_json($connectoutput);
            foreach my $prod ( @{$decoded} ) {
                if ($prod->{"identifier"} eq "CAASP") {
                    $regcode = $prod->{"regcode"} if ($regcode eq "");
                    $is_active = 1 if ($prod->{"status"} eq "Registered");
                }
            }
        }
    }

    print OUTPUT "  <suse_register>\n";
    if ($is_active) {
        $smturl = find_smturl() if ($smturl eq "");

        print OUTPUT "    <do_registration 
config:type=\"boolean\">true</do_registration>\n";
        print OUTPUT "    <email>$reg_email</email>\n" unless ($reg_email eq 
"");
        print OUTPUT "    <reg_code>$regcode</reg_code>\n" if (defined $regcode 
&& $regcode ne "");
        print OUTPUT "    <install_updates 
config:type=\"boolean\">true</install_updates>\n";
        print OUTPUT "    <slp_discovery 
config:type=\"boolean\">false</slp_discovery>\n";
        print OUTPUT "    <reg_server>$smturl</reg_server>\n" if ($smturl ne 
"");
    } else {
        print OUTPUT "    <do_registration 
config:type=\"boolean\">false</do_registration>\n";
    }
    print OUTPUT "  </suse_register>\n";
}

#------------------------------------------------------------------------------

sub setup_salt_minion {

    if ($saltmaster ne "") {
        print OUTPUT <<"EOT";
  <files config:type="list">
    <file>
      <file_path>/etc/salt/minion.d/master.conf</file_path>
      <file_contents>
<![CDATA[
EOT
       print OUTPUT "master: $saltmaster\n";
       print OUTPUT <<"EOT";
]]>
      </file_contents>
      <file_owner>root.root</file_owner>
      <file_permissions>640</file_permissions>
    </file>
  </files>
EOT
    }
}

#------------------------------------------------------------------------------

sub setup_networking {
    print OUTPUT <<"EOT";
  <networking>
    <dhcp_options>
      <dhclient_client_id/>
      <dhclient_hostname_option>AUTO</dhclient_hostname_option>
    </dhcp_options>
    <dns>
      <dhcp_hostname config:type="boolean">true</dhcp_hostname>
      <resolv_conf_policy>auto</resolv_conf_policy>
      <write_hostname config:type="boolean">false</write_hostname>
    </dns>
    <interfaces config:type="list">
      <interface>
        <bootproto>dhcp</bootproto>
        <device>eth0</device>
        <dhclient_set_default_route>yes</dhclient_set_default_route>
        <startmode>auto</startmode>
      </interface>
      <interface>
        <bootproto>static</bootproto>
        <device>lo</device>
        <firewall>no</firewall>
        <ipaddr>127.0.0.1</ipaddr>
        <netmask>255.0.0.0</netmask>
        <network>127.0.0.0</network>
        <prefixlen>8</prefixlen>
        <startmode>nfsroot</startmode>
        <usercontrol>no</usercontrol>
      </interface>
    </interfaces>
    <ipv6 config:type="boolean">true</ipv6>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <setup_before_proposal config:type="boolean">true</setup_before_proposal>
    <managed config:type="boolean">false</managed>
    <routing>
      <ipv4_forward config:type="boolean">false</ipv4_forward>
      <ipv6_forward config:type="boolean">false</ipv6_forward>
    </routing>
  </networking>
EOT
}

#------------------------------------------------------------------------------

Reply via email to