From d86097780408d683d1c83db35ffb2ae4284cb8f3 Mon Sep 17 00:00:00 2001 From: Carlos Barria Date: Wed, 6 Sep 2023 10:08:18 -0300 Subject: [PATCH] (node/hexrot) profile for hexrot --- Puppetfile | 1 + hieradata/role/hexrot.yaml | 24 ++++++ site/profile/manifests/ts/hexrot.pp | 45 +++++++++++ spec/hosts/roles/hexrot_spec.rb | 113 +++++++++++++++++++++++++--- spec/support/spec/nexusctio.rb | 72 ++++++++++++++++++ spec/support/spec/ni_packages.rb | 29 +++++++ 6 files changed, 275 insertions(+), 9 deletions(-) create mode 100644 site/profile/manifests/ts/hexrot.pp create mode 100644 spec/support/spec/nexusctio.rb create mode 100644 spec/support/spec/ni_packages.rb diff --git a/Puppetfile b/Puppetfile index 796387d027..af04aa42c8 100644 --- a/Puppetfile +++ b/Puppetfile @@ -13,6 +13,7 @@ mod 'fervid/snapd', '1.2.1' # 2021-05-31 hreinking: snapd for EAS Raspberry Pi mod 'jamtur01/httpauth', '0.0.6' mod 'jcpunk/irqbalance', '1.0.5' mod 'jhoblitt/ipmi', '5.3.1' +mod 'lsst/anaconda', '0.1.0' mod 'lsst/ccs_daq', '1.1.0' mod 'lsst/ccs_database', '3.2.0' mod 'lsst/ccs_hcu', '3.5.0' diff --git a/hieradata/role/hexrot.yaml b/hieradata/role/hexrot.yaml index 9c674f6a33..8287e99788 100644 --- a/hieradata/role/hexrot.yaml +++ b/hieradata/role/hexrot.yaml @@ -1,5 +1,6 @@ --- classes: + - "anaconda" - "mate" - "profile::core::common" - "profile::core::debugutils" @@ -7,6 +8,7 @@ classes: - "profile::core::docker::prune" - "profile::core::ni_packages" - "profile::core::x2go" + - "profile::ts::hexrot" - "profile::ts::nexusctio" files: /rubin: @@ -18,6 +20,8 @@ files: subscribe: - "Package[runHexEui]" - "Package[runRotEui]" + - "Package[runM2Cntlr]" + # / on hexrot.cp was formated with xfs fstype=0 (long, long, long ago) and is # not compatible with overlayfs[2] profile::core::docker::storage_driver: "devicemapper" @@ -27,3 +31,23 @@ accounts::group_list: ensure: "present" gid: 70014 forcelocal: true + +anaconda::anaconda_version: "Anaconda3-2023.07-2" +anaconda::python_env_name: "py311" +anaconda::python_env_version: "3.11" +anaconda::conda_packages: + pyside6: + channel: "conda-forge" + version: "6.7.0" + qasync: + channel: "conda-forge" + version: "0.23.0" + qt6-charts: + channel: "conda-forge" + version: "6.7.0" + ts-m2com: + channel: "lsstts" + version: "1.5.4" + ts-m2gui: + channel: "lsstts" + version: "1.0.2" diff --git a/site/profile/manifests/ts/hexrot.pp b/site/profile/manifests/ts/hexrot.pp new file mode 100644 index 0000000000..73d540f04f --- /dev/null +++ b/site/profile/manifests/ts/hexrot.pp @@ -0,0 +1,45 @@ +# @summary +# Sets up repos and symlinks for hexrot + +class profile::ts::hexrot { + vcsrepo { '/opt/ts_config_mttcs': + ensure => present, + provider => git, + source => 'https://github.com/lsst-ts/ts_config_mttcs.git', + revision => 'v0.12.8', + keep_local_changes => false, + } + file { '/etc/profile.d/hexrot_path.sh': + ensure => file, + mode => '0644', + # lint:ignore:strict_indent + content => @(ENV), + export QT_API="PySide6" + export PYTEST_QT_API="PySide6" + export TS_CONFIG_MTTCS_DIR="/opt/ts_config_mttcs" + | ENV + # lint:endignore + require => Vcsrepo['/opt/ts_config_mttcs'], + } + file { '/rubin/mtm2/python': + ensure => directory, + owner => 73006, + group => 73006, + } + file { '/rubin/mtm2/python/run_m2gui': + ensure => link, + owner => 73006, + group => 73006, + target => '/opt/anaconda/envs/py311/bin/run_m2gui', + } + file { ['/rubin/rotator', '/rubin/hexapod', '/rubin/mtm2']: + ensure => directory, + owner => 73006, + group => 73006, + recurse => true, + } + file { ['/rubin/rotator/log', '/rubin/hexapod/log', '/rubin/mtm2/log']: + ensure => directory, + mode => '0775', + } +} diff --git a/spec/hosts/roles/hexrot_spec.rb b/spec/hosts/roles/hexrot_spec.rb index 800d5ea268..4f17174d8b 100644 --- a/spec/hosts/roles/hexrot_spec.rb +++ b/spec/hosts/roles/hexrot_spec.rb @@ -6,6 +6,8 @@ describe "#{role} role" do on_supported_os.each do |os, os_facts| + next unless os =~ %r{almalinux-9-x86_64} + context "on #{os}" do let(:facts) { os_facts } let(:node_params) do @@ -24,24 +26,117 @@ it { is_expected.to compile.with_all_deps } + include_examples 'debugutils' include_examples 'common', os_facts: os_facts, site: site include_examples 'x2go packages', os_facts: os_facts + include_examples 'ni_packages' + include_examples 'nexusctio' it { is_expected.to contain_class('mate') } # XXX hexrot uses devicemapper, so the docker example group isn't included - it { is_expected.to contain_class('docker') } + it do + is_expected.to contain_class('docker').with( + package_source: 'docker-ce', + socket_group: 70_014, + socket_override: false, + storage_driver: 'devicemapper', + ) + end + + it { is_expected.to contain_cron__job('docker_prune') } + + it do + is_expected.to contain_vcsrepo('/opt/ts_config_mttcs').with( + ensure: 'present', + provider: 'git', + source: 'https://github.com/lsst-ts/ts_config_mttcs.git', + revision: 'v0.12.8', + keep_local_changes: 'false', + ) + end + + pkgs = { + 'pyside6' => { + 'channel' => 'conda-forge', + 'version' => '6.7.0', + }, + 'qasync' => { + 'channel' => 'conda-forge', + 'version' => '0.23.0', + }, + 'qt6-charts' => { + 'channel' => 'conda-forge', + 'version' => '6.7.0', + }, + 'ts-m2com' => { + 'channel' => 'lsstts', + 'version' => '1.5.4', + }, + 'ts-m2gui' => { + 'channel' => 'lsstts', + 'version' => '1.0.2', + }, + } - %w[ - profile::core::common - profile::core::debugutils - profile::core::docker - profile::core::docker::prune - profile::core::ni_packages - ].each do |c| - it { is_expected.to contain_class(c) } + it do + is_expected.to contain_class('anaconda').with( + anaconda_version: 'Anaconda3-2023.07-2', + python_env_name: 'py311', + python_env_version: '3.11', + conda_packages: pkgs, + ) end it { is_expected.to contain_package('docker-compose-plugin') } + + it do + is_expected.to contain_file('/etc/profile.d/hexrot_path.sh').with( + ensure: 'file', + mode: '0644', + content: <<~CONTENT, + export QT_API="PySide6" + export PYTEST_QT_API="PySide6" + export TS_CONFIG_MTTCS_DIR="/opt/ts_config_mttcs" + CONTENT + ) + end + + it do + is_expected.to contain_file('/rubin/mtm2/python').with( + ensure: 'directory', + owner: '73006', + group: '73006', + ) + end + + it do + is_expected.to contain_file('/rubin/mtm2/python/run_m2gui').with( + ensure: 'link', + owner: '73006', + group: '73006', + target: '/opt/anaconda/envs/py311/bin/run_m2gui', + ) + end + + ['/rubin/rotator', '/rubin/hexapod', '/rubin/mtm2'].each do |path| + it do + is_expected.to contain_file(path).with( + ensure: 'directory', + owner: '73006', + group: '73006', + recurse: 'true', + ) + end + end + + ['/rubin/rotator/log', '/rubin/hexapod/log', '/rubin/mtm2/log'].each do |path| + it do + is_expected.to contain_file(path).with( + ensure: 'directory', + mode: '0775', + ) + end + end end # host end # lsst_sites end # on os diff --git a/spec/support/spec/nexusctio.rb b/spec/support/spec/nexusctio.rb new file mode 100644 index 0000000000..4d0ac6866e --- /dev/null +++ b/spec/support/spec/nexusctio.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +shared_examples 'nexusctio' do + it do + is_expected.to contain_yumrepo('nexus-ctio').with( + 'baseurl' => 'http://cagvm3.ctio.noao.edu/nexus/repository/labview-rpm/rubin/', + 'gpgcheck' => false, + ) + end + + it do + is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-MSO').with( + ensure: 'file', + mode: '0644', + content: <<~GPG, + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: GnuPG v2.0.22 (GNU/Linux) + + mQINBGC3zR8BEACw7AKpnTXmhvjHU5hfdBfbbdOx8azUtW3Oogr6zUcAMd0meTfj + 4msB71LePoMX6WskN9RckoIJvxlIjcVPlbCe7euBDLiQL1KhuQXWK5veYIlsBYMx + agL8CA/rHEk1yfvuk9pxS7CqziRQ4laxJPnYbrOaRZevYlumyusDfGQ17x3EbM1D + N3UYvnzhla0lq/YmGSLVNgmqMV8PJSzv+iQku5MbI4ahxSCnVedOvepXdcePQPwf + /IZc/4IwquKjTNXCs+WhlMbM7T/0M1WeYm7h52UwUOlWB2pgN1ry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WRNvC/oSyD4pjt7zSEVv00Ztr9TaDNVvkImgeJEi2SrGyU1D4vUovbhftny + /2mHLBnu/N9tBGwBwhrv3C7Rn3K2AsRVcEQ2MMzfyvSDzrSicfjAlgblCGB0seuN + jCeAZOfjE/V9ZC+m1JkpnAs7T9ohM/q7HuYjzQIXFJVFz7tmfPUcg8OAm5VxqfVV + 57ub2L8VgFR7slja0VIPnEG38VieSRmx02Inc8fEAAw/ah+EZXEvKap4O2laGY4y + VZVguIMRVVHAOTu0iUTwPlfPNI/jjn2J8ULisIfbuTKd0Vn30kaahBFY4E/R3h9C + geZo96fkKa4JwN7hKtZZv8uzwUWuFGuDlU1tQ2VkNUgj8ksfaagXE0G/L27iKeZN + mGwfdNWtlEnjiolxK2xNmzwotDqnneRZLz8uoCG3fogcJi28YqtHddCQdRNLxScx + DfJsUyrAgCt9bXnnJtKi5Kv6gAtkP02Qz7Kez8gh0W6VYQcRYOxLnmISaWf3woGx + 05/9YPDdeXVApp8JHlmgLKM1nm2a2A8JsIaZpLGhBcawo1xicnU2yMSTvpgouopT + GtqYBCi14V6IEZbVzYeIz1EkT12RP7CtnWYbJN/zyenK3LMowkPigythoAY8tRzL + eO+RKR5uzsEbWmMvQkTP + =vYiw + -----END PGP PUBLIC KEY BLOCK----- + GPG + ) + end +end diff --git a/spec/support/spec/ni_packages.rb b/spec/support/spec/ni_packages.rb new file mode 100644 index 0000000000..6d82423b21 --- /dev/null +++ b/spec/support/spec/ni_packages.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +shared_examples 'ni_packages' do + all_packages = [ + 'runHexEui', + 'runRotEui', + 'runM2Cntlr', + 'git', + 'mlocate', + 'wget', + 'openssl-devel', + 'make', + 'gcc-c++', + 'bzip2-devel', + 'libffi-devel', + 'libXinerama', + 'mesa-libGL', + 'libstdc++.i686', + 'libXft', + 'libXinerama.i686', + 'mesa-libGL.i686', + ] + + all_packages.each do |pkg| + it { is_expected.to contain_package(pkg) } + end + + it { is_expected.to contain_host('cagvm3.ctio.noao.edu').with(ip: '139.229.3.76') } +end