diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 94bdbdc..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,16 +0,0 @@ -engines: - # disable Rubocop at CodeClimate, it cannot read the shared config from - # the /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml file - rubocop: - enabled: false - - duplication: - enabled: true - config: - languages: - - ruby - -ratings: - paths: - - "**.rb" - - Rakefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index de468f0..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,119 +0,0 @@ -# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions - -name: CI - -on: [ push, pull_request ] - -jobs: - Tests: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - name: Git Checkout - uses: actions/checkout@v2 - - # just for easier debugging... - - name: Inspect Installed Packages - run: rpm -qa | sort - - - name: Unit Tests - run: rake test:unit - # enable code coverage reporting - env: - COVERAGE: 1 - - # send the coverage report to coveralls.io - - name: Coveralls Report - # send it only from the TW build to avoid duplicate submits - if: ${{ matrix.distro == 'tumbleweed' }} - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - Rubocop: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - name: Git Checkout - uses: actions/checkout@v2 - - - name: Rubocop - run: rake check:rubocop - - Package: - # skip in master, but run in forks - if: github.ref_name != 'master' || github.repository_owner != 'yast' - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - name: Git Checkout - uses: actions/checkout@v2 - - - name: Package Build - run: yast-ci-ruby -o package - - Yardoc: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - name: Git Checkout - uses: actions/checkout@v2 - - - name: Yardoc - run: rake check:doc - - # downloading the Docker image takes some time so bundling several fast - # checks into one job avoids that overhead - Checks: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - distro: [ "tumbleweed" ] - - container: - image: registry.opensuse.org/yast/head/containers_${{matrix.distro}}/yast-ruby - - steps: - - name: Git Checkout - uses: actions/checkout@v2 - - - name: Perl Syntax - run: yast-ci-ruby -o perl_syntax - - - name: POT Check - run: rake check:pot diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml deleted file mode 100644 index 766f61e..0000000 --- a/.github/workflows/submit.yml +++ /dev/null @@ -1,29 +0,0 @@ -# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions - -name: OBS - -on: - # only when committing to master - push: - branches: master - - # allow running manually from GitHub Web - workflow_dispatch: - -jobs: - submit: - # do not run in forks - if: github.repository_owner == 'yast' - - runs-on: ubuntu-latest - - # the default timeout is 6 hours, do not wait for that long if osc gets stucked - timeout-minutes: 30 - - steps: - - name: Submit the package - # see https://github.com/yast/actions/blob/master/submit/action.yml - uses: yast/actions/submit@master - with: - obs_user: ${{ secrets.OBS_USER }} - obs_password: ${{ secrets.OBS_PASSWORD }} diff --git a/.rspec b/.rspec deleted file mode 100644 index cc212b2..0000000 --- a/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color --format doc diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index f4930dd..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,3 +0,0 @@ -# use the shared Yast defaults -inherit_from: - /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml diff --git a/.spell.yml b/.spell.yml deleted file mode 100644 index a351f3c..0000000 --- a/.spell.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This is the repository specific custom dictionary -# -# Write the words in alphabetical order, one word per line. -# If an unknown word is generic put it into the global dictionary -# in yast-rake in lib/tasks/spell.yml file. - ---- -ignore: - - "doc/**/*" - - "coverage/**/*" -dictionary: - - CaaSP - - Kubic - - SLE - - SMT - - rubydoc - - yardoc diff --git a/COPYING b/COPYING deleted file mode 100644 index d159169..0000000 --- a/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - 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, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 80245c0..0000000 --- a/Gemfile +++ /dev/null @@ -1,13 +0,0 @@ -source "https://rubygems.org" - -group :test do - gem "rake" - gem "yard" - gem "yast-rake", ">= 0.2.13" - gem "rspec", "~> 3.3.0" - gem "gettext", require: false - gem "rubocop", "~> 0.41.2", require: false - gem "simplecov", require: false - gem "coveralls", require: false if ENV["TRAVIS"] - gem "cheetah" -end diff --git a/README.md b/README.md index 338bd19..7b0833d 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,11 @@ -YaST - CaaSP/Kubic Integration -============================== +Obsoleted Module +================ -[![Workflow Status](https://github.com/yast/yast-caasp/workflows/CI/badge.svg?branch=master)]( -https://github.com/yast/yast-caasp/actions?query=branch%3Amaster) -[![OBS](https://github.com/yast/yast-caasp/actions/workflows/submit.yml/badge.svg)](https://github.com/yast/yast-caasp/actions/workflows/submit.yml) -[![Coverage Status](https://img.shields.io/coveralls/yast/yast-caasp.svg)](https://coveralls.io/r/yast/yast-caasp?branch=master) -[![Code Climate](https://codeclimate.com/github/yast/yast-caasp/badges/gpa.svg)](https://codeclimate.com/github/yast/yast-caasp) +**This module is obsoleted and is not developed anymore.** -This repository contains code which is specific for the [Containers as a Service Platform -(CaaSP)](https://www.suse.com/documentation/suse-caasp/) product and -the [openSUSE Kubic](https://kubic.opensuse.org/) project. +GIT +--- +If you want to see the last state check the [*master_old*](../master_old) branch. -Provided Functionality -====================== - -This module provides specific configuration options displayed during the SUSE CaaSP and -openSUSE Kubic installation. - -See [the generated yardoc documentation](http://www.rubydoc.info/github/yast/yast-caasp) at rubydoc.info. - - -Getting the Sources -=================== - -To get the source code, clone the GitHub repository: - - $ git clone https://github.com/yast/yast-caasp.git - -If you want to contribute into the project you can -[fork](https://help.github.com/articles/fork-a-repo/) the repository and clone your fork. - - -Development -=========== - -This module is developed as part of YaST. See the -[development documentation](http://yastgithubio.readthedocs.org/en/latest/development/). - - -Contact -======= - -If you have any question, feel free to ask at the [development mailing -list](http://lists.opensuse.org/yast-devel/) or at the -[#yast](https://webchat.freenode.net/?channels=%23yast) IRC channel on freenode. +Use the [*SLE-15-GA*](../SLE-15-GA) branch for SLE-15 maintenance. diff --git a/RPMNAME b/RPMNAME deleted file mode 100644 index 1b27b56..0000000 --- a/RPMNAME +++ /dev/null @@ -1 +0,0 @@ -yast2-caasp diff --git a/Rakefile b/Rakefile deleted file mode 100644 index f0c0750..0000000 --- a/Rakefile +++ /dev/null @@ -1,15 +0,0 @@ -require "yast/rake" - -Yast::Tasks.submit_to((ENV["YAST_SUBMIT"] || :factory).to_sym) - -Yast::Tasks.configuration do |conf| - # lets ignore license check for now - conf.skip_license_check << /.*/ -end - -task "test:unit" => "test:unit:env" - -task "test:unit:env" do - # run tests in English locale (to avoid problems with translations) - ENV["LC_ALL"] = "en_US.UTF-8" -end diff --git a/doc/autoyast.md b/doc/autoyast.md deleted file mode 100644 index 61d2d17..0000000 --- a/doc/autoyast.md +++ /dev/null @@ -1,69 +0,0 @@ -# AutoYaST support - -When using Containers as a Service Platform (CaaSP), AutoYaST profiles for -workers can be generated using the `caasp-tools` package. However, that's not -the case for dashboard systems. - -To properly set up a dashboard system using AutoYaST, some additional tweaks are -needed. Most of them can be achieved by running some small scripts at the end of -the installation (and before the 1st boot) adding them to the -`scripts/chroot-scripts` section. - -```xml - - - - - -``` - -## Running the `activate.sh` script - -To set up a dashboard system, the `activate.sh` script should be run at the end -of the installation. It can be done by simply adding this script to the -`chroot-scripts` section: - -```xml - - -``` - -## Configuring the NTP server - -The dashboard system will act as NTP server for cluster workers. By default, the -NTP configuration shipped with SUSE allows workers to synchronize with the -dashboard. However, no remote time source is set. - -To do that, is enough with adding `server` lines to the current configuration. -Again, an AutoYaST script will do the trick: - -```xml - - - -``` - -Replace the list of servers (`server1 server2 server3`) for your own NTP servers. diff --git a/doc/system-roles-handlers.md b/doc/system-roles-handlers.md deleted file mode 100644 index e8422ea..0000000 --- a/doc/system-roles-handlers.md +++ /dev/null @@ -1,19 +0,0 @@ -# System Roles Handlers - -This package contains handlers for *Dashboard* and *Worker* system roles. - -## Dashboard role - -A system which is designed as the dashboard will need to run the special script `/usr/share` -`/usr/share/caasp-container-manifests/activate.sh`. That script will take care of -doing some final configuration and enabling some services. - -## Worker role - -When installing a system with this role, a master server will be specified by the user. - -The Salt minion will be configured using that master server, which means that the file -`/etc/salt/minion.d/master` will be created (or updated if it exists) using the given value. - -The master server will be used also as a ntp server. The handler will configure systemd timesyncd -as the ntp client modifying the `/etc/systemd/timesyncd` NTP attribute with the given value. diff --git a/package/yast2-caasp.changes b/package/yast2-caasp.changes deleted file mode 100644 index b77a392..0000000 --- a/package/yast2-caasp.changes +++ /dev/null @@ -1,180 +0,0 @@ -------------------------------------------------------------------- -Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger - -- 5.0.0 (bsc#1185510) - -------------------------------------------------------------------- -Fri Mar 03 14:44:07 UTC 2023 - Ladislav Slezák - -- Bump version to 4.6.0 (bsc#1208913) - -------------------------------------------------------------------- -Wed Apr 06 13:24:58 UTC 2022 - Ladislav Slezák - -- Bump version to 4.5.0 (bsc#1198109) - -------------------------------------------------------------------- -Tue Apr 27 10:30:25 UTC 2021 - Knut Anderssen - -- Drop Yast::LanItems dependency (bsc#1185338) -- 4.4.1 - -------------------------------------------------------------------- -Tue Apr 20 13:51:55 UTC 2021 - Ladislav Slezák - -- 4.4.0 - -------------------------------------------------------------------- -Wed Feb 19 12:57:29 UTC 2020 - Imobach Gonzalez Sosa - -- Rely on the new Y2Network::NtpServer class (jsc#SLE-7188). -- 4.2.3 - -------------------------------------------------------------------- -Mon Aug 26 09:31:45 CEST 2019 - schubi@suse.de - -- Using rb_default_ruby_abi tag in the spec file in order to - handle several ruby versions (bsc#1146403). -- 4.2.2 - -------------------------------------------------------------------- -Wed Aug 14 16:11:04 UTC 2019 - kukuk@suse.de - -- MicroOS update [bsc#1135342] - - Add NTP configuration -- Kubic Node dialog - - NTP configuration - - salt-minion configuration -- 4.2.1 - -------------------------------------------------------------------- -Wed Jun 12 11:28:35 CEST 2019 - schubi@suse.de - -- Enabling chrony-wait service too (bsc#1137196). -- 4.2.0 - -------------------------------------------------------------------- -Fri Nov 9 16:09:30 UTC 2018 - lslezak@suse.cz - -- Kubic updates (bsc#1114818) - - Propose using the openSUSE pool.ntp.org servers when the DHCP - response does not include any - - Updated kubeadm dialog title -- 4.1.2 - -------------------------------------------------------------------- -Thu Oct 25 14:06:41 UTC 2018 - lslezak@suse.cz - -- Added Kubeadm role dialog for openSUSE Kubic (FATE#325834) -- 4.1.1 - -------------------------------------------------------------------- -Tue Oct 16 16:55:40 CEST 2018 - schubi@suse.de - -- Added license file to spec. - -------------------------------------------------------------------- -Mon Oct 15 08:35:57 UTC 2018 - mfilka@suse.com - -- fate#323454 - - NTP servers proposal is based on DHCP response too. -- 4.1.0 - -------------------------------------------------------------------- -Mon Aug 20 16:49:53 CEST 2018 - schubi@suse.de - -- Switched license in spec file from SPDX2 to SPDX3 format. - -------------------------------------------------------------------- -Tue Apr 10 13:42:01 UTC 2018 - jreidinger@suse.com - -- Do not build on 32-bit architecture as some dependencies are not - available there (bsc#1088852) -- 4.0.5 - -------------------------------------------------------------------- -Tue Jan 30 10:36:58 UTC 2018 - igonzalezsosa@suse.com - -- Handle product features overlay in a proper way (bsc#1077038). -- 4.0.4 - -------------------------------------------------------------------- -Tue Dec 12 13:16:49 UTC 2017 - jreidinger@suse.com - -- Use chrony instead of ntp (FATE#323432) -- 4.0.3 - -------------------------------------------------------------------- -Wed Sep 27 10:03:25 UTC 2017 - jreidinger@suse.com - -- fix building with roles with order (related to fix for - bsc#1049297) -- 4.0.2 - -------------------------------------------------------------------- -Tue Sep 12 09:03:53 UTC 2017 - knut.anderssen@suse.com - -- Replace /info.txt by /README.BETA as beta file to be shown - (bsc#1047060). -- 4.0.1 - -------------------------------------------------------------------- -Thu Sep 7 12:06:32 UTC 2017 - jreidinger@suse.com - -- Add language selection (FATE#323837) -- Mark all user visible strings for translation (FATE#323837) -- 4.0.0 - -------------------------------------------------------------------- -Mon Sep 4 12:25:38 UTC 2017 - knut.anderssen@suse.com - -- Fix keyboard selection widget requirement (fate#322276) -- 1.1.2 - -------------------------------------------------------------------- -Mon Jun 5 18:37:34 UTC 2017 - knut.anderssen@suse.com - -- Rearrange of keyboard and registration code widgets (bsc#1022768) -- 1.1.1 - -------------------------------------------------------------------- -Fri May 12 14:29:47 UTC 2017 - igonzalezsosa@suse.com - -- Adapt the system roles widget to yast2-installation 3.2.x - (bsc#1038854) -- 1.1.0 - -------------------------------------------------------------------- -Fri Apr 28 09:26:30 UTC 2017 - igonzalezsosa@suse.com - -- Move specific CaaSP code from yast2-installation - (bsc#1036838) -- 1.0.4 - -------------------------------------------------------------------- -Thu Apr 27 11:56:47 UTC 2017 - igonzalezsosa@suse.com - -- Add the iburst option to the NTP server configuration - (FATE#323249) -- 1.0.3 - -------------------------------------------------------------------- -Fri Apr 21 15:51:51 UTC 2017 - igonzalezsosa@suse.com - -- Configure the administration node as a NTP server/client - (FATE#323249) -- 1.0.2 - -------------------------------------------------------------------- -Thu Apr 20 09:20:29 WEST 2017 - knut.anderssen@suse.com - -- fate#323250 - - Added systemd timesyncd configuration in worker role handler. -- 1.0.1 - -------------------------------------------------------------------- -Thu Mar 23 21:46:43 UTC 2017 - igonzalezsosa@suse.com - -- Initial version -- 1.0.0 - diff --git a/package/yast2-caasp.spec b/package/yast2-caasp.spec deleted file mode 100644 index 5e3de21..0000000 --- a/package/yast2-caasp.spec +++ /dev/null @@ -1,80 +0,0 @@ -# -# spec file for package yast2-caasp -# -# 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: yast2-caasp -Version: 5.0.0 -Release: 0 - -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: %{name}-%{version}.tar.bz2 - -# SystemRoleHandlersRunner -Requires: yast2 -BuildRequires: yast2 -# Overview widget -Requires: yast2-installation >= 3.2.38 -BuildRequires: yast2-installation >= 3.2.38 -# chrony support -Requires: yast2-ntp-client >= 4.0.3 -BuildRequires: yast2-ntp-client >= 4.0.3 -# Drop Yast::LanItems -Requires: yast2-network >= 4.4.7 -BuildRequires: yast2-network >= 4.4.7 - -BuildRequires: yast2-devtools >= 3.1.39 -BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) -BuildRequires: rubygem(%{rb_default_ruby_abi}:yast-rake) >= 0.2.13 - -BuildArch: noarch - -Summary: YaST2 - CaaSP Module -License: GPL-2.0-only -Group: System/YaST -Url: https://github.com/yast/yast-caasp - -%description -Containers as a Service Platform (CaaSP) and openSUSE Kubic specific module. - -%prep -%setup -n %{name}-%{version} - -%build - -%check -%yast_check - -%install -%yast_install - -%files -%defattr(-,root,root) -%{yast_clientdir}/*.rb -%dir %{yast_libdir}/y2caasp -%{yast_libdir}/y2caasp/*.rb -%dir %{yast_libdir}/y2caasp/cfa -%{yast_libdir}/y2caasp/cfa/*.rb -%dir %{yast_libdir}/y2caasp/widgets -%{yast_libdir}/y2caasp/widgets/*.rb -%dir %{yast_libdir}/y2caasp/clients -%{yast_libdir}/y2caasp/clients/*.rb -%dir %{yast_libdir}/y2system_role_handlers -%{yast_libdir}/y2system_role_handlers/*.rb -%doc %{yast_docdir} -%license COPYING - -%changelog diff --git a/src/clients/inst_casp_admin_role.rb b/src/clients/inst_casp_admin_role.rb deleted file mode 100644 index bf93df8..0000000 --- a/src/clients/inst_casp_admin_role.rb +++ /dev/null @@ -1,2 +0,0 @@ -require "y2caasp/clients/admin_role_dialog" -Y2Caasp::AdminRoleDialog.new.run diff --git a/src/clients/inst_casp_worker_role.rb b/src/clients/inst_casp_worker_role.rb deleted file mode 100644 index 17607d8..0000000 --- a/src/clients/inst_casp_worker_role.rb +++ /dev/null @@ -1,2 +0,0 @@ -require "y2caasp/clients/worker_role_dialog" -Y2Caasp::WorkerRoleDialog.new.run diff --git a/src/clients/inst_kubic_kubeadm_role.rb b/src/clients/inst_kubic_kubeadm_role.rb deleted file mode 100644 index 286eea3..0000000 --- a/src/clients/inst_kubic_kubeadm_role.rb +++ /dev/null @@ -1,3 +0,0 @@ - -require "y2caasp/clients/kubeadm_role_dialog" -Y2Caasp::KubeadmRoleDialog.new.run diff --git a/src/clients/inst_kubic_minion_role.rb b/src/clients/inst_kubic_minion_role.rb deleted file mode 100644 index 1c0e0b4..0000000 --- a/src/clients/inst_kubic_minion_role.rb +++ /dev/null @@ -1,3 +0,0 @@ - -require "y2caasp/clients/kubic_minion_role_dialog" -Y2Caasp::KubicMinionRoleDialog.new.run diff --git a/src/clients/inst_microos_role.rb b/src/clients/inst_microos_role.rb deleted file mode 100644 index 588a7f9..0000000 --- a/src/clients/inst_microos_role.rb +++ /dev/null @@ -1,3 +0,0 @@ - -require "y2caasp/clients/microos_role_dialog" -Y2Caasp::MicroOSRoleDialog.new.run diff --git a/src/lib/y2caasp/cfa/minion_master_conf.rb b/src/lib/y2caasp/cfa/minion_master_conf.rb deleted file mode 100644 index 3ed9769..0000000 --- a/src/lib/y2caasp/cfa/minion_master_conf.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "cfa/base_model" -require "cfa/augeas_parser" -require "cfa/matcher" - -module Y2Caasp - module CFA - # Represents a Salt Minion master configuration file. - class MinionMasterConf < ::CFA::BaseModel - attributes(master: "master") - - # Configuration parser - # - # FIXME: At this time, we're using Augeas' cobblersettings lense because, - # although the file is in yaml format, it doesn't have a YAML header - # which is required by the yaml lense. - PARSER = ::CFA::AugeasParser.new("cobblersettings.lns") - # Path to configuration file - PATH = "/etc/salt/minion.d/master.conf".freeze - - # Constructor - # - # @param file_handler [.read, .write, nil] an object able to read/write a string. - def initialize(file_handler: nil) - super(PARSER, PATH, file_handler: file_handler) - end - - # FIXME: This class should we moved to be easy reused by other modules as for example - # yast-configuration-management is also defining it - def master=(master_name) - # FIXME: the cobblersettings lense does not support dashes in the value - # without single quotes, we need to use a custom lense for salt conf. - # As Salt can use also 'master' just use in case of dashed. - data["master"] = master_name.include?("-") ? "'#{master_name}'" : master_name - end - end - end -end diff --git a/src/lib/y2caasp/cfa/systemd_timesyncd.rb b/src/lib/y2caasp/cfa/systemd_timesyncd.rb deleted file mode 100644 index 445eb59..0000000 --- a/src/lib/y2caasp/cfa/systemd_timesyncd.rb +++ /dev/null @@ -1,55 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "cfa/base_model" -require "cfa/augeas_parser" -require "cfa/matcher" - -module Y2Caasp - module CFA - # Represents systemd timesyncd config file. - class SystemdTimesyncd < ::CFA::BaseModel - # Configuration parser - PARSER = ::CFA::AugeasParser.new("systemd.lns") - # Patch to configuration file - PATH = "/etc/systemd/timesyncd.conf".freeze - - # Constructor - def initialize(file_handler: nil) - super(PARSER, PATH, file_handler: file_handler) - end - - # Sets the NTP variable in [Time] section with the given servers - # - # @params [Array] ntp servers to be used by timesyncd - # @return [Boolean] returns true if added/modified - def ntp_servers=(servers) - tree = data["Time"] ||= ::CFA::AugeasTree.new - ntp_servers = ::CFA::AugeasTree.new - - values = ntp_servers.collection("value") - servers.each { |s| values.add(s) } - - generic_set("NTP", ntp_servers, tree) - end - end - end -end diff --git a/src/lib/y2caasp/clients/admin_role_dialog.rb b/src/lib/y2caasp/clients/admin_role_dialog.rb deleted file mode 100644 index 343090f..0000000 --- a/src/lib/y2caasp/clients/admin_role_dialog.rb +++ /dev/null @@ -1,63 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "cwm/dialog" -require "y2caasp/widgets/ntp_server" -require "y2caasp/dhcp_ntp_servers" -require "y2network/ntp_server" - -module Y2Caasp - # This library provides a simple dialog for setting - # the admin role specific settings: - # - the NTP server names - class AdminRoleDialog < CWM::Dialog - include DhcpNtpServers - - def initialize - textdomain "caasp" - - Yast.import "Product" - Yast.import "ProductFeatures" - super - end - - # - # The dialog title - # - # @return [String] the title - # - def title - # TRANSLATORS: dialog title - _("Admin Node Configuration") - end - - def contents - return @content if @content - - @content = HSquash( - MinWidth(50, - # preselect the servers from the DHCP response - Y2Caasp::Widgets::NtpServer.new(ntp_servers)) - ) - end - end -end diff --git a/src/lib/y2caasp/clients/kubeadm_role_dialog.rb b/src/lib/y2caasp/clients/kubeadm_role_dialog.rb deleted file mode 100644 index acbc82c..0000000 --- a/src/lib/y2caasp/clients/kubeadm_role_dialog.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "yast" - -# so far the Kubic dialog is the same as in CaaSP, -# just with different title and defaults -require "y2caasp/clients/admin_role_dialog" - -module Y2Caasp - # This library provides a simple dialog for setting - # the kubeadm role specific settings: - # - the NTP server names - class KubeadmRoleDialog < AdminRoleDialog - def initialize - textdomain "caasp" - super - end - - # - # The dialog title - # - # @return [String] the title - # - def title - # TRANSLATORS: dialog title - _("kubeadm Node Configuration") - end - end -end diff --git a/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb b/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb deleted file mode 100644 index 6fd869c..0000000 --- a/src/lib/y2caasp/clients/kubic_minion_role_dialog.rb +++ /dev/null @@ -1,63 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2019 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "cwm/dialog" -require "y2caasp/widgets/kubic_admin_node" -require "y2caasp/widgets/ntp_server" -require "y2caasp/dhcp_ntp_servers" -require "y2network/ntp_server" - -module Y2Caasp - # This library provides a simple dialog for setting - # the worker node specific settings: - # - the admin node name - # - the NTP server names - class KubicMinionRoleDialog < CWM::Dialog - include DhcpNtpServers - - def initialize - textdomain "caasp" - - Yast.import "Product" - Yast.import "ProductFeatures" - super - end - - def title - # TRANSLATORS: dialog title - _("Kubic Node Configuration") - end - - def contents - return @content if @content - - @content = HSquash( - MinWidth(50, - VBox( - Y2Caasp::Widgets::KubicAdminNode.new, - VSpacing(2), - # preselect the servers from the DHCP response - Y2Caasp::Widgets::NtpServer.new(ntp_servers) - )) - ) - end - end -end diff --git a/src/lib/y2caasp/clients/microos_role_dialog.rb b/src/lib/y2caasp/clients/microos_role_dialog.rb deleted file mode 100644 index b670cf4..0000000 --- a/src/lib/y2caasp/clients/microos_role_dialog.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "yast" - -# so far the Kubic dialog is the same as in CaaSP, -# just with different title and defaults -require "y2caasp/clients/admin_role_dialog" - -module Y2Caasp - # This library provides a simple dialog for setting - # the kubeadm role specific settings: - # - the NTP server names - class MicroOSRoleDialog < AdminRoleDialog - def initialize - textdomain "caasp" - super - end - - # - # The dialog title - # - # @return [String] the title - # - def title - # TRANSLATORS: dialog title - _("NTP Configuration") - end - end -end diff --git a/src/lib/y2caasp/clients/worker_role_dialog.rb b/src/lib/y2caasp/clients/worker_role_dialog.rb deleted file mode 100644 index f43fffa..0000000 --- a/src/lib/y2caasp/clients/worker_role_dialog.rb +++ /dev/null @@ -1,58 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "cwm/dialog" -require "y2caasp/widgets/controller_node" -require "y2caasp/widgets/ntp_server" -require "y2caasp/dhcp_ntp_servers" - -module Y2Caasp - # This library provides a simple dialog for setting - # the worker node specific settings: - # - the admin node name - # - the NTP server names - class WorkerRoleDialog < CWM::Dialog - include DhcpNtpServers - - def initialize - textdomain "caasp" - super - end - - def title - _("Cluster Node Configuration") - end - - def contents - return @content if @content - - @content = HSquash( - MinWidth(50, - VBox( - Y2Caasp::Widgets::ControllerNode.new, - VSpacing(2), - # preselect the servers from the DHCP response - Y2Caasp::Widgets::NtpServer.new(dhcp_ntp_servers) - )) - ) - end - end -end diff --git a/src/lib/y2caasp/dhcp_ntp_servers.rb b/src/lib/y2caasp/dhcp_ntp_servers.rb deleted file mode 100644 index ee4eee0..0000000 --- a/src/lib/y2caasp/dhcp_ntp_servers.rb +++ /dev/null @@ -1,66 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" - -module Y2Caasp - # This module provides a functionality for reading the NTP servers - module DhcpNtpServers - # - # List of NTP servers from DHCP - # - # @return [Array] List of servers (IP or host names), empty if not provided - # - def dhcp_ntp_servers - Yast.import "Lan" - - Yast::Lan.dhcp_ntp_servers - end - - # - # Propose the NTP servers from the DHCP response, fallback to a random - # machine from the ntp.org pool if enabled in control.xml. - # - # @return [Array] proposed NTP servers, empty if nothing suitable found - # - def ntp_servers - # TODO: use Yast::NtpClient.ntp_conf if configured - # to better handle going back - servers = dhcp_ntp_servers - servers = ntp_fallback if servers.empty? - - servers - end - - # - # The fallback servers for NTP configuration - # - # @return [Array] the fallback servers, empty if disabled in control.xml - # - def ntp_fallback - # propose the fallback when enabled in control file - return [] unless Yast::ProductFeatures.GetBooleanFeature("globals", "default_ntp_setup") - - default_servers = Y2Network::NtpServer.default_servers - return [] if default_servers.empty? - - [default_servers.sample.hostname] - end - end -end diff --git a/src/lib/y2caasp/widgets/controller_node.rb b/src/lib/y2caasp/widgets/controller_node.rb deleted file mode 100644 index 4922a50..0000000 --- a/src/lib/y2caasp/widgets/controller_node.rb +++ /dev/null @@ -1,88 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "cwm/widget" -require "installation/system_role" - -Yast.import "IP" -Yast.import "Hostname" - -module Y2Caasp - module Widgets - # This widget is responsible of validate and store the introduced location - # which must be a valid IP or FQDN. - # bsc#1032057: old name: Controller Node, new name: Administration Node. - class ControllerNode < CWM::InputField - def initialize - textdomain "caasp" - end - - def label - _("Administration Node") - end - - def help - # TRANSLATORS: a help text for the controller node input field - _("

The Controller Node

") + - # TRANSLATORS: a help text for the controller node input field - _("

Enter the host name or the IP address of the controller node " \ - "to which this machine will be connected to.

") - end - - # It stores the value of the input field if validates - # - # @see #validate - def store - # this is a role widget so a role must be selected before saving - raise("No role selected") unless role - role["controller_node"] = value - end - - # The input field is initialized with previous stored value - def init - self.value = role["controller_node"] if role - end - - # It returns true if the value is a valid IP or a valid FQDN, if not it - # displays a popup error. - # - # @return [Boolean] true if valid IP or FQDN - def validate - return true if Yast::IP.Check(value) || Yast::Hostname.CheckFQ(value) - - Yast::Popup.Error( - # TRANSLATORS: error message for invalid administration node location - _("Not valid location for the administration node, " \ - "please enter a valid IP or Hostname") - ) - - false - end - - private - - def role - ::Installation::SystemRole.current_role - end - end - end -end diff --git a/src/lib/y2caasp/widgets/kubic_admin_node.rb b/src/lib/y2caasp/widgets/kubic_admin_node.rb deleted file mode 100644 index 9942ad9..0000000 --- a/src/lib/y2caasp/widgets/kubic_admin_node.rb +++ /dev/null @@ -1,88 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2019 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "cwm/widget" -require "installation/system_role" - -Yast.import "IP" -Yast.import "Hostname" - -module Y2Caasp - module Widgets - # This widget is responsible of validate and store the introduced location - # which must be a valid IP or FQDN. - # bsc#1032057: old name: Controller Node, new name: Administration Node. - class KubicAdminNode < CWM::InputField - def initialize - textdomain "caasp" - end - - def label - _("Kubic Admin Node") - end - - def help - # TRANSLATORS: a help text for the kubic admin node input field - _("

The Kubic Admin Node

") + - # TRANSLATORS: a help text for the kubic admin node input field - _("

Enter the host name or the IP address of the kubic admin node " \ - "to which this machine will be connected to.

") - end - - # It stores the value of the input field if validates - # - # @see #validate - def store - # this is a role widget so a role must be selected before saving - raise("No role selected") unless role - role["kubic_admin_node"] = value - end - - # The input field is initialized with previous stored value - def init - self.value = role["kubic_admin_node"] if role - end - - # It returns true if the value is a valid IP or a valid FQDN, if not it - # displays a popup error. - # - # @return [Boolean] true if valid IP or FQDN - def validate - return true if Yast::IP.Check(value) || Yast::Hostname.CheckFQ(value) - - Yast::Popup.Error( - # TRANSLATORS: error message for invalid administration node location - _("Not valid location for the kubic admin node, " \ - "please enter a valid IP or Hostname") - ) - - false - end - - private - - def role - ::Installation::SystemRole.current_role - end - end - end -end diff --git a/src/lib/y2caasp/widgets/ntp_server.rb b/src/lib/y2caasp/widgets/ntp_server.rb deleted file mode 100644 index a98deff..0000000 --- a/src/lib/y2caasp/widgets/ntp_server.rb +++ /dev/null @@ -1,141 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "installation/system_role" -require "cwm/widget" - -Yast.import "CWM" -Yast.import "Popup" -Yast.import "Label" -Yast.import "IP" -Yast.import "Hostname" -Yast.import "NtpClient" - -module Y2Caasp - module Widgets - # This widget is responsible of validating and storing the NTP server to use. - class NtpServer < CWM::InputField - extend Yast::I18n - - # @return [Array] List of default servers - attr_reader :default_servers - - # Constructor - # - # @params default_servers [Array] List of servers - def initialize(default_servers = []) - @default_servers = default_servers - textdomain "caasp" - end - - # @return [String] Widget's label - def label - # TRANSLATORS: input field label - _("N&TP Servers (comma or space separated)") - end - - # Store the value of the input field if validates - def store - if servers.empty? - # we need to reset the previous settings after going back - Yast::NtpClient.ntp_selected = false - Yast::NtpClient.modified = false - return - end - - Yast::NtpClient.ntp_selected = true - Yast::NtpClient.modified = true - Yast::NtpClient.ntp_conf.clear_pools - servers.each { |server| Yast::NtpClient.ntp_conf.add_pool(server) } - # run NTP as a service (not via cron) - Yast::NtpClient.run_service = true - Yast::NtpClient.synchronize_time = false - end - - # Initializes the widget's value - def init - saved_servers = (role && role["ntp_servers"]) || default_servers - self.value = saved_servers.join(" ") - end - - NOT_VALID_SERVERS_MESSAGE = N_("Not valid location for the NTP servers:\n%{servers}" \ - "\n\nPlease, enter a valid IP or Hostname").freeze - # Validate input - # - # * All specified IPs or hostnames should be valid - # * If no server is specified, ask the user whether proceed with installation or not - # - # @return [Boolean] true if value is valid; false otherwise. - def validate - return skip_ntp_server? if servers.empty? - invalid_servers = servers.reject { |v| Yast::IP.Check(v) || Yast::Hostname.CheckFQ(v) } - return true if invalid_servers.empty? - Yast::Popup.Error( - format(_(NOT_VALID_SERVERS_MESSAGE), servers: invalid_servers.join(", ")) - ) - - false - end - - def help - # TRANSLATORS: a help text for the NTP server input field - _("

NTP Servers

") + - # TRANSLATORS: a help text for the NTP server input field - _("

Enter the host name or the IP address of the NTP server which will be used for " \ - "synchronizing the time on this machine

") + - # TRANSLATORS: a help text for the NTP server input field - _("

Use comma (,) or space to separate multiple values.

") - end - - private - - # Parse the widget's value an return the potential list of hostnames/addresses - # - # @return [Array] List of hostnames/addresses - def servers - value.to_s.tr(",", " ").split(" ") - end - - # Check if the user wants to intentionally skip the NTP server configuration - # - # @return [Boolean] true if user wants to skip it; false otherwise. - def skip_ntp_server? - Yast::Popup.AnyQuestion( - _("NTP Servers"), - # TRANSLATORS: error message for invalid ntp server name/address - _("You have not configured an NTP server. This may lead to\n" \ - "your cluster not functioning properly or at all.\n" \ - "Proceed with caution and at your own risk.\n\n" \ - "Would you like to continue with the installation?"), - Yast::Label.YesButton, - Yast::Label.NoButton, - :yes - ) - end - - # Return the current role - def role - ::Installation::SystemRole.current_role - end - end - end -end diff --git a/src/lib/y2system_role_handlers/dashboard_role_finish.rb b/src/lib/y2system_role_handlers/dashboard_role_finish.rb deleted file mode 100644 index e59ffc4..0000000 --- a/src/lib/y2system_role_handlers/dashboard_role_finish.rb +++ /dev/null @@ -1,85 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "yast2/execute" -require "installation/system_role" -require "installation/services" -require "cfa/chrony_conf" - -module Y2SystemRoleHandlers - # Implement finish handler for the "dashboard" role - class DashboardRoleFinish - include Yast::Logger - - # Path to the activation script - ACTIVATION_SCRIPT_PATH = "/usr/share/caasp-container-manifests/activate.sh".freeze - - def run - run_activation_script - setup_ntp - end - - protected - - # Run the activation script - def run_activation_script - log.info "Running the activation script" - Yast::Execute.on_target(ACTIVATION_SCRIPT_PATH) - end - - # Configure the NTP server - # - # @see update_ntp_conf - def setup_ntp - return unless role["ntp_servers"] - log.info "Updating the NTP daemon configuration with servers: #{role["ntp_servers"]}" - update_chrony_conf - enable_service - end - - # Update the chrony.conf file - # - # Set the server specified in the role configuration ({ntp_servers}) - def update_chrony_conf - return unless role["ntp_servers"] - chrony_conf = CFA::ChronyConf.new - chrony_conf.load - chrony_conf.clear_pools - role["ntp_servers"].each do |server| - chrony_conf.add_pool(server) - end - chrony_conf.save - end - - # Add the ntpd service to the list of services to enable - def enable_service - ::Installation::Services.enabled |= ["chronyd", "chrony-wait"] - end - - # Dashboard role - # - # @return [::Installation::SystemRole,nil] Dashboard role or nil if not defined. - def role - ::Installation::SystemRole.find("dashboard_role") - end - end -end diff --git a/src/lib/y2system_role_handlers/kubic_lb_role_finish.rb b/src/lib/y2system_role_handlers/kubic_lb_role_finish.rb deleted file mode 100644 index 72993b0..0000000 --- a/src/lib/y2system_role_handlers/kubic_lb_role_finish.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2019 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "y2caasp/cfa/minion_master_conf" - -# The kubic_*_finish.rb content is identical, it's only used -# by different system roles. So if you change here something, -# all other files have to be changed, too. - -module Y2SystemRoleHandlers - # Implement finish handler for the "kubic lb" role - class KubicLbRoleFinish - include Yast::Logger - - def run - role = ::Installation::SystemRole.current_role - - if !role - log.warn("Current role not found, not saving the config") - return - end - - master = role["kubic_admin_node"] - log.info("The kubic admin node for this worker role is: #{master}") - - configure_salt_minion(master) - enable_salt_minion_service - end - - private - - # Configure Salt minion - def configure_salt_minion(master) - master_conf = ::Y2Caasp::CFA::MinionMasterConf.new - - begin - master_conf.load - rescue Errno::ENOENT - log.info("The minion master.conf file does not exist, it will be created") - end - - # FIXME: the cobblersettings lense does not support dashes in the url - # without single quotes, we need to use a custom lense for salt conf. - # As Salt can use also 'url' just use in case of dashed. - master_conf.master = master - master_conf.save - end - - def enable_salt_minion_service - ::Installation::Services.enabled << "salt-minion" - end - end -end diff --git a/src/lib/y2system_role_handlers/kubic_worker_role_finish.rb b/src/lib/y2system_role_handlers/kubic_worker_role_finish.rb deleted file mode 100644 index fa23d28..0000000 --- a/src/lib/y2system_role_handlers/kubic_worker_role_finish.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2019 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "y2caasp/cfa/minion_master_conf" - -# The kubic_*_finish.rb content is identical, it's only used -# by different system roles. So if you change here something, -# all other files have to be changed, too. - -module Y2SystemRoleHandlers - # Implement finish handler for the "kubic worker" role - class KubicWorkerRoleFinish - include Yast::Logger - - def run - role = ::Installation::SystemRole.current_role - - if !role - log.warn("Current role not found, not saving the config") - return - end - - master = role["kubic_admin_node"] - log.info("The kubic admin node for this worker role is: #{master}") - - configure_salt_minion(master) - enable_salt_minion_service - end - - private - - # Configure Salt minion - def configure_salt_minion(master) - master_conf = ::Y2Caasp::CFA::MinionMasterConf.new - - begin - master_conf.load - rescue Errno::ENOENT - log.info("The minion master.conf file does not exist, it will be created") - end - - # FIXME: the cobblersettings lense does not support dashes in the url - # without single quotes, we need to use a custom lense for salt conf. - # As Salt can use also 'url' just use in case of dashed. - master_conf.master = master - master_conf.save - end - - def enable_salt_minion_service - ::Installation::Services.enabled << "salt-minion" - end - end -end diff --git a/src/lib/y2system_role_handlers/worker_role_finish.rb b/src/lib/y2system_role_handlers/worker_role_finish.rb deleted file mode 100644 index 8249336..0000000 --- a/src/lib/y2system_role_handlers/worker_role_finish.rb +++ /dev/null @@ -1,91 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2017 SUSE LLC -# -# -# 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 SUSE. -# -# To contact SUSE about this file by physical or electronic mail, you may find -# current contact information at www.suse.com. -# ------------------------------------------------------------------------------ - -require "yast" -require "y2caasp/cfa/minion_master_conf" -require "y2caasp/cfa/systemd_timesyncd" - -module Y2SystemRoleHandlers - # Implement finish handler for the "worker" role - class WorkerRoleFinish - include Yast::Logger - - def run - role = ::Installation::SystemRole.current_role - - if !role - log.warn("Current role not found, not saving the config") - return - end - - master = role["controller_node"] - log.info("The controller node for this worker role is: #{master}") - - configure_salt_minion(master) - configure_systemd_timesync(role["ntp_servers"]) - enable_timesync_service - end - - private - - # Configure Salt minion - def configure_salt_minion(master) - master_conf = ::Y2Caasp::CFA::MinionMasterConf.new - - begin - master_conf.load - rescue Errno::ENOENT - log.info("The minion master.conf file does not exist, it will be created") - end - - # FIXME: the cobblersettings lense does not support dashes in the url - # without single quotes, we need to use a custom lense for salt conf. - # As Salt can use also 'url' just use in case of dashed. - master_conf.master = master - master_conf.save - end - - # - # Save the timesyncd configuration - # - # @param servers [Array,nil] the NTP servers, if empty or nil - # the timesyncd configuration is not saved - def configure_systemd_timesync(servers) - log.info("Configured NTP servers: #{servers.inspect}") - return if servers.nil? || servers.empty? - - timesync_conf = ::Y2Caasp::CFA::SystemdTimesyncd.new - - begin - timesync_conf.load - rescue Errno::ENOENT - log.info("Systemd timesync.conf file does not exist, it will be created") - end - - timesync_conf.ntp_servers = servers - timesync_conf.save - end - - def enable_timesync_service - ::Installation::Services.enabled << "systemd-timesyncd" - end - end -end diff --git a/test/fixtures/cfa/minion.d/master.conf b/test/fixtures/cfa/minion.d/master.conf deleted file mode 100644 index 7dafcc0..0000000 --- a/test/fixtures/cfa/minion.d/master.conf +++ /dev/null @@ -1 +0,0 @@ -master: salt diff --git a/test/fixtures/cfa/timesyncd b/test/fixtures/cfa/timesyncd deleted file mode 100644 index 4cb86ee..0000000 --- a/test/fixtures/cfa/timesyncd +++ /dev/null @@ -1,3 +0,0 @@ -[Time] -#NTP=ntp1.suse.de ntp2.suse.de -#FallbackNTP=ntp1.opensuse.org ntp2.opensuse.org diff --git a/test/fixtures/chrony.conf b/test/fixtures/chrony.conf deleted file mode 100644 index 9f376fa..0000000 --- a/test/fixtures/chrony.conf +++ /dev/null @@ -1,38 +0,0 @@ -# Use public servers from the pool.ntp.org project. -# Please consider joining the pool (http://www.pool.ntp.org/join.html). -pool 2.opensuse.pool.ntp.org iburst - -# Record the rate at which the system clock gains/losses time. -driftfile /var/lib/chrony/drift - -# Allow the system clock to be stepped in the first three updates -# if its offset is larger than 1 second. -makestep 1.0 3 - -# Enable kernel synchronization of the real-time clock (RTC). -rtcsync - -# Enable hardware timestamping on all interfaces that support it. -#hwtimestamp * - -# Increase the minimum number of selectable sources required to adjust -# the system clock. -#minsources 2 - -# Allow NTP client access from local network. -#allow 192.168.0.0/16 - -# Serve time even if not synchronized to a time source. -#local stratum 10 - -# Specify file containing keys for NTP authentication. -#keyfile /etc/chrony.keys - -# Get TAI-UTC offset and leap seconds from the system tz database. -#leapsectz right/UTC - -# Specify directory for log files. -logdir /var/log/chrony - -# Select which information is logged. -#log measurements statistics tracking diff --git a/test/fixtures/minion.d/master.conf_existent b/test/fixtures/minion.d/master.conf_existent deleted file mode 100644 index 500fa29..0000000 --- a/test/fixtures/minion.d/master.conf_existent +++ /dev/null @@ -1 +0,0 @@ -master: previous_controller diff --git a/test/fixtures/minion.d/master.conf_expected b/test/fixtures/minion.d/master.conf_expected deleted file mode 100644 index c383b87..0000000 --- a/test/fixtures/minion.d/master.conf_expected +++ /dev/null @@ -1 +0,0 @@ -master: salt_controller diff --git a/test/lib/widgets/controller_node_test.rb b/test/lib/widgets/controller_node_test.rb deleted file mode 100755 index 00b2d08..0000000 --- a/test/lib/widgets/controller_node_test.rb +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env rspec - -require_relative "../../test_helper" -require "cwm/rspec" -require "y2caasp/widgets/controller_node" - -describe Y2Caasp::Widgets::ControllerNode do - subject(:widget) do - Y2Caasp::Widgets::ControllerNode.new - end - - let(:role) do - Installation::SystemRole.new( - id: "test_role", order: "100", label: "Test role", description: "Test description" - ) - end - - before do - allow(Installation::SystemRole).to receive(:current_role).and_return(role) - allow(Yast::Popup).to receive(:Error) - end - - include_examples "CWM::AbstractWidget" - - describe "#init" do - let(:value) { "server1" } - - it "reads initial value from the current role" do - allow(role).to receive(:[]).with("controller_node") - .and_return(value) - expect(widget).to receive(:value=).with(value) - widget.init - end - end - - describe "#store" do - let(:value) { "server1" } - - before do - allow(widget).to receive(:value).and_return(value) - end - - it "sets the role controller_node property" do - widget.store - expect(role["controller_node"]).to eq(value) - end - end - - describe "#validate" do - before do - allow(widget).to receive(:value).and_return(value) - end - - context "when a valid IP address is provided" do - let(:value) { "192.168.122.1" } - - it "returns true" do - expect(widget.validate).to eq(true) - end - end - - context "when a valid hostname is provided" do - let(:value) { "server.example.com" } - - it "returns true" do - expect(widget.validate).to eq(true) - end - end - - context "when an invalid value is provided" do - let(:value) { "***" } - - it "returns false" do - expect(widget.validate).to eq(false) - end - - it "reports the problem to the user" do - expect(Yast::Popup).to receive(:Error) - widget.validate - end - end - - context "when no value is provided" do - let(:value) { "" } - - it "returns false" do - expect(widget.validate).to eq(false) - end - - it "reports the problem to the user" do - expect(Yast::Popup).to receive(:Error) - widget.validate - end - end - end -end diff --git a/test/lib/widgets/ntp_server_test.rb b/test/lib/widgets/ntp_server_test.rb deleted file mode 100755 index ad3ee3c..0000000 --- a/test/lib/widgets/ntp_server_test.rb +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env rspec - -require_relative "../../test_helper" -require "cwm/rspec" -require "y2caasp/widgets/ntp_server" - -describe Y2Caasp::Widgets::NtpServer do - subject(:widget) { Y2Caasp::Widgets::NtpServer.new } - let(:dashboard_role) { ::Installation::SystemRole.new(id: "dashboard_role", order: "100") } - - before do - allow(::Installation::SystemRole).to receive(:current_role).and_return(dashboard_role) - end - - include_examples "CWM::AbstractWidget" - - describe "#init" do - subject(:widget) { Y2Caasp::Widgets::NtpServer.new(["ntp.suse.de"]) } - - it "reads initial value from dashboard role" do - allow(dashboard_role).to receive(:[]).with("ntp_servers") - .and_return(["server1"]) - expect(widget).to receive(:value=).with("server1") - widget.init - end - - context "when dashboard role does not define any server" do - it "uses the default servers" do - expect(widget).to receive(:value=).with("ntp.suse.de") - widget.init - end - end - end - - describe "#store" do - let(:value) { "" } - - let(:ntp_conf) { double("ntp conf") } - - before do - allow(widget).to receive(:value).and_return(value) - - allow(Yast::NtpClient).to receive(:modified=) - allow(Yast::NtpClient).to receive(:ntp_selected=) - allow(Yast::NtpClient).to receive(:ntp_conf).and_return(ntp_conf) - allow(ntp_conf).to receive(:clear_pools) - allow(ntp_conf).to receive(:add_pool) - allow(Yast::NtpClient).to receive(:run_service=) - allow(Yast::NtpClient).to receive(:synchronize_time=) - end - - context "when value is empty" do - it "sets the role ntp_servers property to an empty array" do - expect(ntp_conf).to_not receive(:add_pool) - widget.store - end - end - - context "when value is a hostname/address" do - let(:value) { "server1" } - - it "sets the role ntp_servers property to an array containing the hostname/address" do - expect(ntp_conf).to receive(:add_pool).with(value) - widget.store - end - end - - context "when several hostnames/addresses separated by spaces" do - let(:value) { "server1 server2" } - - it "sets the role ntp_servers property to an array containing all the hostnames/addresses" do - expect(ntp_conf).to receive(:add_pool).with("server1") - expect(ntp_conf).to receive(:add_pool).with("server2") - widget.store - end - end - - context "when several hostnames/addresses separated by commas" do - let(:value) { "server1,server2" } - - it "sets the role ntp_servers property to an array containing all the hostnames/addresses" do - expect(ntp_conf).to receive(:add_pool).with("server1") - expect(ntp_conf).to receive(:add_pool).with("server2") - widget.store - end - end - - context "when more than one hostname/address separated by mixed spaces and commas" do - let(:value) { "server1,server2 server3" } - - it "sets the role ntp_servers property to an array containing all the hostnames/addresses" do - expect(ntp_conf).to receive(:add_pool).with("server1") - expect(ntp_conf).to receive(:add_pool).with("server2") - expect(ntp_conf).to receive(:add_pool).with("server3") - widget.store - end - end - end - - describe "#validate" do - before do - allow(widget).to receive(:value).and_return(value) - end - - context "when valid IP addresses are provided" do - let(:value) { "192.168.122.1 10.0.0.1" } - - it "returns true" do - expect(widget.validate).to eq(true) - end - end - - context "when valid hostnames are provided" do - let(:value) { "ntp.suse.de ntp.suse.cz" } - - it "returns true" do - expect(widget.validate).to eq(true) - end - end - - context "when non valid addresses/hostnames are provided" do - let(:value) { "ntp.suse.de ***" } - - it "returns false" do - allow(Yast::Popup).to receive(:Error) - expect(widget.validate).to eq(false) - end - - it "reports the problem to the user" do - expect(Yast::Popup).to receive(:Error) - widget.validate - end - end - - context "when no value is provided" do - let(:value) { "" } - - it "returns false" do - expect(widget.validate).to eq(false) - end - end - end -end diff --git a/test/lib/y2caasp/cfa/minion_master_conf_test.rb b/test/lib/y2caasp/cfa/minion_master_conf_test.rb deleted file mode 100644 index 27b4a7b..0000000 --- a/test/lib/y2caasp/cfa/minion_master_conf_test.rb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env rspec - -require_relative "../../../test_helper" -require "y2caasp/cfa/minion_master_conf" -require "cfa/memory_file" - -describe Y2Caasp::CFA::MinionMasterConf do - subject(:config) { Y2Caasp::CFA::MinionMasterConf.new(file_handler: file) } - - let(:content) { File.read(File.join(FIXTURES_PATH, "cfa", "minion.d", "master.conf")) } - let(:file) { CFA::MemoryFile.new(content) } - - before do - config.load - end - - describe "#master" do - it "returns master server name" do - expect(config.master).to eq("salt") - end - end - - describe "#master=" do - it "sets the master server name" do - expect { config.master = "alt" }.to change { config.master }.to("alt") - expect { config.master = "salt-master" }.to change { config.master }.to("'salt-master'") - config.save - expect(file.content.lines).to include("master: 'salt-master'\n") - end - end -end diff --git a/test/lib/y2caasp/cfa/systemd_timesyncd_test.rb b/test/lib/y2caasp/cfa/systemd_timesyncd_test.rb deleted file mode 100644 index df2f522..0000000 --- a/test/lib/y2caasp/cfa/systemd_timesyncd_test.rb +++ /dev/null @@ -1,30 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../../test_helper" -require "y2caasp/cfa/systemd_timesyncd" -require "cfa/memory_file" - -def timesyncd_disk_content - File.read(path) -end - -describe Y2Caasp::CFA::SystemdTimesyncd do - subject(:timesyncd) { Y2Caasp::CFA::SystemdTimesyncd.new(file_handler: file) } - - let(:content) { File.read(File.join(FIXTURES_PATH, "cfa", "timesyncd")) } - let(:file) { CFA::MemoryFile.new(content) } - - describe "#ntp_servers=" do - it "sets the given ntp servers in the 'NTP' variable under 'Time' section " do - timesyncd.load - timesyncd.ntp_servers = ["master"] - timesyncd.save - - expect(file.content).to include( - "[Time]\n" \ - "NTP=master\n" \ - "#FallbackNTP=ntp1.opensuse.org ntp2.opensuse.org\n" - ) - end - end -end diff --git a/test/lib/y2caasp/clients/admin_role_dialog_test.rb b/test/lib/y2caasp/clients/admin_role_dialog_test.rb deleted file mode 100755 index 385ac9c..0000000 --- a/test/lib/y2caasp/clients/admin_role_dialog_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../../test_helper.rb" -require_relative "role_dialog_examples" -require "cwm/rspec" - -require "y2caasp/clients/admin_role_dialog" - -Yast.import "CWM" -Yast.import "Lan" -Yast.import "Wizard" - -describe ::Y2Caasp::AdminRoleDialog do - describe "#run" do - let(:ntp_servers) { [] } - - before do - allow(Yast::Wizard).to receive(:CreateDialog) - allow(Yast::Wizard).to receive(:CloseDialog) - allow(Yast::CWM).to receive(:show).and_return(:next) - allow(Yast::Lan).to receive(:dhcp_ntp_servers).and_return([]) - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - end - - include_examples "CWM::Dialog" - include_examples "NTP from DHCP" - - # Note: this is a hypothetical test, in real CaaSP the default NTP setup - # is currently disabled in control.xml - context "no NTP server set in DHCP and default NTP is enabled in control.xml" do - let(:default_servers) do - [ - Y2Network::NtpServer.new("0.suse.pool.ntp.org"), - Y2Network::NtpServer.new("1.suse.pool.ntp.org") - ] - end - - before do - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - .with("globals", "default_ntp_setup").and_return(true) - allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) - end - - it "proposes to use a random server from the default pool" do - expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| - expect(arg.size).to eq(1) - expect(arg.first).to match(/suse.pool.ntp.org/) - original.call(arg) - end - subject.run - end - end - end -end diff --git a/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb b/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb deleted file mode 100644 index deeede6..0000000 --- a/test/lib/y2caasp/clients/kubeadm_role_dialog_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../../test_helper.rb" -require_relative "role_dialog_examples" -require "cwm/rspec" - -require "y2caasp/clients/kubeadm_role_dialog.rb" - -Yast.import "CWM" -Yast.import "Lan" -Yast.import "Wizard" - -describe Y2Caasp::KubeadmRoleDialog do - describe "#run" do - let(:ntp_servers) { [] } - - before do - allow(Yast::Wizard).to receive(:CreateDialog) - allow(Yast::Wizard).to receive(:CloseDialog) - allow(Yast::CWM).to receive(:show).and_return(:next) - allow(Yast::Lan).to receive(:dhcp_ntp_servers).and_return([]) - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - end - - include_examples "CWM::Dialog" - include_examples "NTP from DHCP" - - context "no NTP server set in DHCP and default NTP is enabled in control.xml" do - let(:default_servers) do - [ - Y2Network::NtpServer.new("0.suse.pool.ntp.org"), - Y2Network::NtpServer.new("1.suse.pool.ntp.org") - ] - end - - before do - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - .with("globals", "default_ntp_setup").and_return(true) - allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) - end - - it "proposes to use a random server from the default pool" do - expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| - expect(default_servers.map(&:hostname)).to include(arg.first) - original.call(arg) - end - subject.run - end - end - end -end diff --git a/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb b/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb deleted file mode 100644 index 0c2ddfc..0000000 --- a/test/lib/y2caasp/clients/kubic_minion_role_dialog_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (c) [2020] SUSE LLC -# -# 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 SUSE LLC. -# -# To contact SUSE LLC about this file by physical or electronic mail, you may -# find current contact information at www.suse.com. - -require_relative "../../../test_helper.rb" -require_relative "role_dialog_examples" -require "cwm/rspec" - -require "y2caasp/clients/kubic_minion_role_dialog" - -Yast.import "CWM" -Yast.import "Lan" -Yast.import "Wizard" - -describe ::Y2Caasp::KubicMinionRoleDialog do - describe "#run" do - let(:ntp_servers) { [] } - - before do - allow(Yast::Wizard).to receive(:CreateDialog) - allow(Yast::Wizard).to receive(:CloseDialog) - allow(Yast::CWM).to receive(:show).and_return(:next) - allow(Yast::Lan).to receive(:dhcp_ntp_servers).and_return([]) - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - end - - include_examples "CWM::Dialog" - include_examples "NTP from DHCP" - - # Note: this is a hypothetical test, in real CaaSP the default NTP setup - # is currently disabled in control.xml - context "no NTP server set in DHCP and default NTP is enabled in control.xml" do - let(:default_servers) do - [ - Y2Network::NtpServer.new("0.suse.pool.ntp.org"), - Y2Network::NtpServer.new("1.suse.pool.ntp.org") - ] - end - - before do - allow(Yast::ProductFeatures).to receive(:GetBooleanFeature) - .with("globals", "default_ntp_setup").and_return(true) - allow(Y2Network::NtpServer).to receive(:default_servers).and_return(default_servers) - end - - it "proposes to use a random server from the default pool" do - expect(Y2Caasp::Widgets::NtpServer).to receive(:new).and_wrap_original do |original, arg| - expect(arg.size).to eq(1) - expect(arg.first).to match(/suse.pool.ntp.org/) - original.call(arg) - end - subject.run - end - end - end -end diff --git a/test/lib/y2caasp/clients/role_dialog_examples.rb b/test/lib/y2caasp/clients/role_dialog_examples.rb deleted file mode 100644 index de22669..0000000 --- a/test/lib/y2caasp/clients/role_dialog_examples.rb +++ /dev/null @@ -1,13 +0,0 @@ - -shared_examples "NTP from DHCP" do - context "when some NTP server is detected via DHCP" do - let(:ntp_servers) { ["ntp.example.com"] } - - it "proposes to use it by default" do - expect(Yast::Lan).to receive(:dhcp_ntp_servers).and_return(ntp_servers) - expect(Y2Caasp::Widgets::NtpServer).to receive(:new) - .with(ntp_servers).and_call_original - subject.run - end - end -end diff --git a/test/lib/y2caasp/clients/worker_role_dialog_test.rb b/test/lib/y2caasp/clients/worker_role_dialog_test.rb deleted file mode 100755 index 741a874..0000000 --- a/test/lib/y2caasp/clients/worker_role_dialog_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../../test_helper.rb" -require_relative "role_dialog_examples" -require "cwm/rspec" - -require "y2caasp/clients/worker_role_dialog.rb" - -Yast.import "CWM" -Yast.import "Lan" -Yast.import "Wizard" - -describe ::Y2Caasp::WorkerRoleDialog do - describe "#run" do - before do - allow(Yast::Wizard).to receive(:CreateDialog) - allow(Yast::Wizard).to receive(:CloseDialog) - allow(Yast::CWM).to receive(:show).and_return(:next) - allow(Yast::Lan).to receive(:dhcp_ntp_servers).and_return([]) - end - - include_examples "CWM::Dialog" - include_examples "NTP from DHCP" - end -end diff --git a/test/lib/y2system_role_handlers/dashboard_role_finish_test.rb b/test/lib/y2system_role_handlers/dashboard_role_finish_test.rb deleted file mode 100755 index b6fe248..0000000 --- a/test/lib/y2system_role_handlers/dashboard_role_finish_test.rb +++ /dev/null @@ -1,70 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../test_helper" -require "y2system_role_handlers/dashboard_role_finish" - -describe Y2SystemRoleHandlers::DashboardRoleFinish do - subject(:handler) { described_class.new } - - let(:ntp_server) { "ntp.suse.de" } - let(:ntp_servers) { [ntp_server] } - - before do - stub_const("CFA::ChronyConf::PATH", FIXTURES_PATH.join("chrony.conf").to_s) - allow(CFA::ChronyConf).to receive(:new).and_return(ntp_conf) - end - - let(:role) do - ::Installation::SystemRole.new(id: "dashboard_role", order: "100").tap do |role| - role["ntp_servers"] = ntp_servers - end - end - - before do - allow(::Installation::SystemRole).to receive(:find) - .with("dashboard_role").and_return(role) - allow(Yast::Execute).to receive(:on_target) - end - - describe "#run" do - let(:ntp_conf) { CFA::ChronyConf.new } - - before do - allow(ntp_conf).to receive(:save) - end - - it "runs the activation script" do - expect(Yast::Execute).to receive(:on_target).with(/activate.sh/) - handler.run - end - - context "when a NTP server is specified" do - it "adds the server to the configuration" do - handler.run - records = ntp_conf.pools - expect(records.keys).to eq([ntp_server]) - expect(records.values).to eq([{ "iburst" => nil }]) - end - - it "writes the NTP configuration" do - expect(ntp_conf).to receive(:save) - handler.run - end - - it "sets the chrony services to be enabled" do - handler.run - expect(::Installation::Services.enabled).to include("chronyd") - expect(::Installation::Services.enabled).to include("chrony-wait") - end - end - - context "when no NTP server is specified" do - let(:ntp_servers) { nil } - - it "does not modify NTP configuration" do - expect(CFA::ChronyConf).to_not receive(:new) - handler.run - end - end - end -end diff --git a/test/lib/y2system_role_handlers/worker_role_finish_test.rb b/test/lib/y2system_role_handlers/worker_role_finish_test.rb deleted file mode 100755 index c166f96..0000000 --- a/test/lib/y2system_role_handlers/worker_role_finish_test.rb +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env rspec - -require_relative "../../test_helper" -require "installation/system_role" -require "y2system_role_handlers/worker_role_finish" - -describe Y2SystemRoleHandlers::WorkerRoleFinish do - subject(:handler) { described_class.new } - let(:role) { instance_double("::Installation::SystemRole") } - let(:conf) do - instance_double("Y2Caasp::CFA::MinionMasterConf", load: true, save: true) - end - - before do - allow(::Installation::SystemRole).to receive(:current_role).and_return(role) - allow(Y2Caasp::CFA::MinionMasterConf).to receive(:new).and_return(conf) - allow(handler).to receive(:enable_timesync_service) - allow(handler).to receive(:configure_salt_minion) - allow(handler).to receive(:configure_systemd_timesync) - allow(role).to receive(:[]) - end - - describe ".run" do - it "saves the controller node location into the minion master.conf file" do - expect(role).to receive(:[]).with("controller_node").and_return("controller") - expect(handler).to receive(:configure_salt_minion).with("controller") - - handler.run - end - - it "configures systemd timesync ntp server" do - expect(role).to receive(:[]).with("ntp_servers").and_return(["controller"]) - - expect(handler).to receive(:configure_systemd_timesync).with(["controller"]) - handler.run - end - - it "sets systemd-timesync.service to be enabled during installation" do - expect(role).to receive(:[]).with("ntp_servers").and_return(["controller"]) - expect(handler).to receive(:enable_timesync_service) - - handler.run - end - end -end diff --git a/test/test_helper.rb b/test/test_helper.rb deleted file mode 100644 index aae0b9c..0000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2017 SUSE LLC. -# -# All Rights Reserved. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of version 2 or 3 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 SUSE LLC. -# -# To contact SUSE about this file by physical or electronic mail, -# you may find current contact information at www.suse.com -# -# Set the paths -src_path = File.expand_path("../../src", __FILE__) -ENV["Y2DIR"] = src_path - -require "yast" -require "yast/rspec" -require "pathname" - -if ENV["COVERAGE"] - require "simplecov" - SimpleCov.start do - add_filter "/test/" - end - - # Files to track for code coverage - SimpleCov.track_files("#{src_path}/**/*.rb") - - # additionally use the LCOV format for on-line code coverage reporting at CI - if ENV["CI"] || ENV["COVERAGE_LCOV"] - require "simplecov-lcov" - - SimpleCov::Formatter::LcovFormatter.config do |c| - c.report_with_single_file = true - # this is the default Coveralls GitHub Action location - # https://github.com/marketplace/actions/coveralls-github-action - c.single_report_path = "coverage/lcov.info" - end - - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::LcovFormatter - ] - end -end - -# configure RSpec -RSpec.configure do |config| - config.mock_with :rspec do |c| - # https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles - c.verify_partial_doubles = true - - config.extend Yast::I18n # available in context/describe - config.include Yast::I18n # available in it/let/before/... - end -end - -TESTS_PATH = Pathname.new(File.dirname(__FILE__)) -FIXTURES_PATH = TESTS_PATH.join("fixtures")