falkorlib 0.8.10 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # git_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Sun 2022-06-05 17:15 svarrette>
5
+ # Time-stamp: <Wed 2023-11-22 17:21 svarrette>
6
6
  #
7
7
  # @description Check the Git operations
8
8
  #
@@ -316,7 +316,7 @@ describe FalkorLib::Git do
316
316
 
317
317
  [ :subtrees, :submodules ].each do |type|
318
318
  it "#config_warn(#{type})" do
319
- t = capture(:stdout) { FalkorLib::Git.config_warn(type) }
319
+ t = capture(:stderr) { FalkorLib::Git.config_warn(type) }
320
320
  expect(t).to include "FalkorLib.config.git"
321
321
  expect(t).to include "FalkorLib.config.git.submodulesdir" if type == :submodules
322
322
  end
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # gitflow_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Sun 2020-04-12 15:15 svarrette>
5
+ # Time-stamp: <Wed 2023-11-22 09:52 svarrette>
6
6
  #
7
7
  # @description Check the Git Flow operations -- see https://github.com/nvie/gitflow
8
8
  #
@@ -50,7 +50,7 @@ describe FalkorLib::GitFlow do
50
50
  it "#branch" do
51
51
  expected = {
52
52
  :master => 'production',
53
- :develop => 'devel'
53
+ :develop => 'master'
54
54
  }
55
55
  expected.each do |type,v|
56
56
  b = FalkorLib::GitFlow.branches(type.to_sym, dir)
@@ -82,9 +82,10 @@ describe FalkorLib::GitFlow do
82
82
  c = FalkorLib::GitFlow.guess_gitflow_config(dir)
83
83
  {
84
84
  :master => 'production',
85
- :develop => 'devel'
85
+ :develop => 'master'
86
86
  }.each do |type,v|
87
- expect(c[:branches][type.to_sym]).to eq(v)
87
+ expect(c[:branches][type.to_sym]).to eq(v) if v.is_a? String
88
+ expect(v).to include(c[:branches][type.to_sym]) if v.is_a? Array
88
89
  end
89
90
  {
90
91
  :feature => 'feature/',
@@ -0,0 +1 @@
1
+ BIBTEX = biber
@@ -155,7 +155,7 @@ The classical markdown syntax `![](<path/to/image>)` does not allow any control
155
155
 
156
156
  So you probaby wish to do it in \LaTeX\ directly
157
157
 
158
- \centerline{\includegraphics[width=4em]{logo_ULHPC.pdf}}
158
+ \centerline{\includegraphics[width=4em]{logo_ANSSI.png}}
159
159
 
160
160
  A normal (left aligned) text afterward
161
161
 
@@ -1,4 +1,4 @@
1
- % Time-stamp: <Thu 2017-08-17 22:22 svarrette>
1
+ % Time-stamp: <Thu 2023-11-23 17:53 svarrette>
2
2
  % =============================================================================
3
3
  % File: <%= config[:name] %>.tex --
4
4
  % Author(s): <%= config[:author] %> (<%= config[:mail] %>)
@@ -15,6 +15,16 @@
15
15
  \documentclass[aspectratio=169]{beamer}
16
16
  % \documentclass[draft]{beamer}
17
17
  \usepackage{_style}
18
+ \usepackage[
19
+ backend=biber,
20
+ maxnames=999,
21
+ giveninits=true,
22
+ style=verbose,
23
+ ]{biblatex}
24
+ % \addbibresource{biblio.bib}
25
+ \setbeamerfont{footnote}{size=\tiny}
26
+ % Usage in slides: \footfullcite{<bibentry>}
27
+
18
28
 
19
29
  % The key part to use my theme -- if you precise nothing, the image that
20
30
  % illustrate the slides is assumed to be images/slides_image.jpg
@@ -41,8 +51,11 @@
41
51
  \author[<%= config[:author] %> \& al.]{
42
52
  \underline{<%= config[:author] %>}
43
53
  }
44
- \institute[University of Luxembourg]{
45
- \myurl{https://hpc.uni.lu}
54
+ \institute[ANSSI/SDE/DST/LAM]{
55
+ ANSSI/SDE/DST/LAM
56
+ Agence nationale de la sécurité des systèmes d'information / French National Cybersecurity Agency
57
+ Laboratoire Architectures Matérielles et logicielles (LAM)
58
+ \myurl{<%= config[:url] %>}
46
59
  }
47
60
 
48
61
  % Mandatory to **declare** a logo to be placed on the bottom right -- normally the
@@ -80,11 +93,10 @@
80
93
  \column{0.5\textwidth}
81
94
  % \emph{Contact}\\
82
95
  {\tiny
83
- \emph{<%= config[:author] %>}\\
84
- ~~~~ \structure{University of Luxembourg, Belval Campus}:\\
85
- ~~~~ Maison du Nombre, 4th floor\\
86
- ~~~~ 2, avenue de l'Universit\'e\\
87
- ~~~~ L-4365 Esch-sur-Alzette\\
96
+ \emph{ANSSI/SDE/DST/LAM}\\
97
+ ~~~~ \structure{Laboratoire Architectures Matérielles et logicielles}\\
98
+ \emph{Contacts:}\\
99
+ ~~~~\emph{<%= config[:author] %>}\\
88
100
  ~~~~ \textit{mail:} \href{mailto:<%= config[:mail] %>}{<%= config[:mail] %>}\\
89
101
  }
90
102
  \column{0.5\textwidth}
Binary file
@@ -0,0 +1,14 @@
1
+ # Created by https://www.toptal.com/developers/gitignore/api/vagrant
2
+ # Edit at https://www.toptal.com/developers/gitignore?templates=vagrant
3
+
4
+ ### Vagrant ###
5
+ # General
6
+ .vagrant/
7
+
8
+ # Log files (if you are creating logs in debug mode, uncomment this)
9
+ # *.log
10
+
11
+ ### Vagrant Patch ###
12
+ *.box
13
+
14
+ # End of https://www.toptal.com/developers/gitignore/api/vagrant
@@ -1,6 +1,6 @@
1
1
  # -*- mode: ruby -*-
2
2
  # vi: set ft=ruby :
3
- # Time-stamp: <Mon 2020-04-20 15:32 svarrette>
3
+ # Time-stamp: <Mon 2023-12-04 17:12 svarrette>
4
4
  ###########################################################################################
5
5
  # __ __ _ __ _ _
6
6
  # \ \ / /_ _ __ _ _ __ __ _ _ __ | |_ / _(_) | ___
@@ -25,7 +25,7 @@ require 'erb'
25
25
  [ 'vagrant-hosts',
26
26
  'vagrant-vbguest',
27
27
  'vagrant-cachier',
28
- # 'vagrant-libvirt',
28
+ 'vagrant-libvirt',
29
29
  'deep_merge',
30
30
  'terminal-table' ].each do |plugin|
31
31
  abort "Install the '#{plugin}' plugin with 'vagrant plugin install #{plugin}'" unless Vagrant.has_plugin?("#{plugin}")
@@ -53,9 +53,10 @@ DEFAULT_SETTINGS = {
53
53
  # Default images settings
54
54
  :defaults => {
55
55
  :os => :<%= config[:os] %>,
56
+ :provider => :<%= config[:provider] %>,
56
57
  :ram => <%= config[:ram] %>,
57
58
  :vcpus => <%= config[:vcpus] %>,
58
- :vbguest_auto_update => true,
59
+ :vbguest_auto_update => false,
59
60
  :role => 'default',
60
61
  # :nodes => 1,
61
62
  },
@@ -66,10 +67,18 @@ DEFAULT_SETTINGS = {
66
67
  },
67
68
  # Default Boxes
68
69
  :boxes => {
69
- :centos8 => '<%= config[:boxes][:centos8] %>',
70
- :centos7 => '<%= config[:boxes][:centos7] %>',
71
- :debian8 => '<%= config[:boxes][:debian8] %>',
72
- :ubuntu14 => '<%= config[:boxes][:ubuntu14] %>'
70
+ :debian12 => '<%= config[:boxes][:debian12] %>',
71
+ :debian12_uefi => '<%= config[:boxes][:debian12_uefi] %>',
72
+ :almalinux9 => '<%= config[:boxes][:almalinux9] %>',
73
+ :almalinux8 => '<%= config[:boxes][:almalinux8] %>',
74
+ :almalinux8_uefi => '<%= config[:boxes][:almalinux8_uefi] %>',
75
+ :rockylinux8 => '<%= config[:boxes][:rockylinux8] %>',
76
+ :centosstream9 => '<%= config[:boxes][:centosstream9] %>',
77
+ :centosstream8 => '<%= config[:boxes][:centosstream8] %>',
78
+ :ubuntu22 => '<%= config[:boxes][:ubuntu22] %>',
79
+ :ubuntu20 => '<%= config[:boxes][:ubuntu20] %>',
80
+ :fedora38 => '<%= config[:boxes][:fedora38] %>',
81
+ :archlinux => '<%= config[:boxes][:archlinux] %>'
73
82
  },
74
83
  # virtual images to deploy
75
84
  # <name>:
@@ -126,18 +135,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
126
135
  # set auto_update to false, if you do NOT want to check the correct
127
136
  # additions version when booting these boxes
128
137
  config.vbguest.auto_update = defaults[:vbguest_auto_update]
138
+ config.vbguest.installer_options = { allow_kernel_upgrade: true }
139
+
129
140
  end
130
141
 
131
142
  # Shell provisioner, to bootstrap each box with the minimal settings/packages
132
143
  DEFAULT_PROVISIONING_SCRIPTS.each do |script|
133
144
  config.vm.provision "shell", path: "#{script}", keep_color: true
134
145
  end
135
- config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
146
+
147
+ # config.vm.synced_folder ".", "/vagrant", type: "virtualbox" # done by default
136
148
  ## Uncomment the below part if you want and additional shared directory
137
149
  # config.vm.synced_folder "vagrant/shared", "/shared", mount_options: ['dmode=777','fmode=777'],
138
150
  # type: "virtualbox" # Shared directory for users
139
151
  if Dir.exist?(File.join(TOP_PUPPETDIR, 'hieradata'))
140
- config.vm.synced_folder "#{puppet_dir}/hieradata", "/tmp/vagrant-puppet/hieradata", type: "virtualbox"
152
+ config.vm.synced_folder "#{puppet_dir}/hieradata", "/tmp/vagrant-puppet/hieradata" #, type: "virtualbox"
141
153
  end
142
154
 
143
155
  # network settings
@@ -161,12 +173,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
161
173
  boxname = defaults[:os].to_s.downcase.gsub(/([^\d]+)(\d+)/, '\\1-\\2')
162
174
  name = boxname if name == 'default'
163
175
  os = node[:os] ? node[:os].to_sym : defaults[:os].to_sym
176
+ provider = (os =~ /_uefi$/)? 'libvirt' : defaults[:provider]
177
+ provider = node[:provider] if node[:provider]
164
178
  ram = node[:ram] ? node[:ram] : defaults[:ram]
165
179
  vcpus = node[:vcpus] ? node[:vcpus] : defaults[:vcpus]
166
180
  role = node[:role] ? node[:role] : 'default'
167
181
  desc = node[:desc] ? node[:desc] : 'n/a'
168
182
  puppet_modules = node[:puppet_modules] ? node[:puppet_modules] : []
169
-
183
+ warn "provider: #{provider}"
170
184
  abort "Non-existing box OS '#{os}' for the VM '#{name}'" if settings[:boxes][os.to_sym].nil?
171
185
  abort "Empty IP address range" if ip_range.empty?
172
186
  ip = ip_range[ ip_index.to_i ].to_s
@@ -175,13 +189,36 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
175
189
  config.vm.define "#{name}" do |c|
176
190
  c.vm.box = settings[:boxes][os.to_sym]
177
191
  c.vm.hostname = "#{fqdn}"
178
- c.vm.network :private_network, :ip => ip
192
+ c.vm.network :private_network,
193
+ :ip => ip,
194
+ :libvirt__network_address => network[:range], # ip_range[0].to_s + '/24',
195
+ :libvirt__forward_mode => 'nat'
196
+
179
197
  c.vm.provision :hosts, :sync_hosts => true
198
+ # (eventually) Force default provider
199
+ c.vm.provider :"#{provider}" if provider != 'virtualbox'
180
200
 
181
- c.vm.provider "virtualbox" do |v|
201
+ # Custom VM configs for virtualbox provider
202
+ c.vm.provider 'virtualbox' do |v|
182
203
  v.customize [ 'modifyvm', :id, '--name', hostname, '--memory', ram.to_s ]
183
204
  v.customize [ 'modifyvm', :id, '--cpus', vcpus.to_s ] if vcpus.to_i > 1
184
205
  #v.customize [ 'setextradata', :id, 'VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root', '1']
206
+ v.customize ["modifyvm", :id, "--firmware", "efi"]
207
+ end
208
+ # Custom VM configs for libvirt provider
209
+ # see https://vagrant-libvirt.github.io/vagrant-libvirt/configuration.html
210
+ c.vm.provider :libvirt do |lv|
211
+ lv.uri = 'qemu:///system'
212
+ lv.host = hostname
213
+ lv.cpus = vcpus
214
+ lv.memory = ram
215
+ # lv.nested = true
216
+
217
+ # Emulated TPM
218
+ lv.tpm_model = "tpm-crb"
219
+ lv.tpm_type = "emulator"
220
+ lv.tpm_version = "2.0"
221
+
185
222
  end
186
223
 
187
224
  # role specialization
@@ -201,8 +238,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
201
238
  end
202
239
 
203
240
  # A role fact MUST be defined (default: 'default') as it is used in Hiera config
241
+ facts_dir = '/etc/facter/facts.d/'
204
242
  c.vm.provision "shell",
205
- inline: "echo '{ \"role\": \"#{role}\" }' > /opt/puppetlabs/facter/facts.d/custom.json",
243
+ inline: "mkdir -p #{facts_dir}; echo '{ \"role\": \"#{role}\" }' > #{facts_dir}/custom.json",
206
244
  keep_color: true
207
245
  ################ Puppet install ##############
208
246
  c.vm.provision "puppet" do |puppet|
@@ -222,14 +260,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
222
260
 
223
261
  __table[:rows] << [ name, fqdn, os.to_sym, "#{vcpus}/#{ram}", role, desc, ip]
224
262
 
225
- if settings[:vms].keys.last == name
263
+ #if settings[:vms].keys.last == name
226
264
  c.trigger.after :up do |trigger|
227
265
  trigger.info = (Terminal::Table.new __table).to_s
228
266
  trigger.warn = <<-EOF
229
267
  - Virtual Vagrant infrastructure successfully deployed!
230
268
  EOF
231
269
  end
232
- end
270
+ #end
233
271
 
234
272
  end # config.vm.define
235
273
  end # settings
@@ -1,5 +1,5 @@
1
1
  # -*- mode: yaml; -*-
2
- # Time-stamp: <Sat 2020-04-18 18:00 svarrette>
2
+ # Time-stamp: <Sat 2023-11-18 16:59 svarrette>
3
3
  ################################################################################
4
4
  # Complementary configuration for Vagrant
5
5
  # You can overwrite here the default settings defined in ../Vagrantfile and
@@ -11,15 +11,18 @@
11
11
  # Format:
12
12
  # :<os><version>: <username>/<box> # see https://vagrantcloud.com
13
13
  # :boxes:
14
- # :centos8: 'centos/8'
15
- # :centos7: 'centos/7'
16
- # :debian8: 'debian/contrib-jessie64'
17
- # :ubuntu14: 'ubuntu/trusty64'
14
+ # :debian12: 'debian/bookworm64'
15
+ # :rockylinux9: 'rockylinux/9'
16
+ # :rockylinux8: 'rockylinux/8'
17
+ # :ubuntu22: 'ubuntu/jammy64'
18
+ # :ubuntu20: 'ubuntu/focal64'
19
+ # :fedora38: 'generic/fedora38'
20
+ # :archlinux: 'archlinux/archlinux'
18
21
 
19
22
  #_________________
20
23
  # Default settings
21
24
  # :defaults:
22
- # :os: :centos7 # Default OS from the above box definition
25
+ # :os: :debian12 # Default OS from the above box definition
23
26
  # :ram: 512 # Default RAM
24
27
  # :vcpus: 1 # Default number of virtual CPUs
25
28
  # :vbguest_auto_update: 1 # check/update box guest additions
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bash
2
- # Time-stamp: <Sun 2020-04-19 12:39 svarrette>
2
+ # Time-stamp: <Mon 2023-12-04 17:51 svarrette>
3
3
  ###########################################################################################
4
4
  # __ __ _ ____ _ _
5
5
  # \ \ / /_ _ __ _ _ __ __ _ _ __ | |_ | __ ) ___ ___ | |_ ___| |_ _ __ __ _ _ __
6
- # \ \ / / _` |/ _` | '__/ _` | '_ \| __| | _ \ / _ \ / _ \| __/ __| __| '__/ _` | '_ \
7
- # \ V / (_| | (_| | | | (_| | | | | |_ | |_) | (_) | (_) | |_\__ \ |_| | | (_| | |_) |
6
+ # \ \ / / _` |/ _` | '__/ _` | '_ \| __| | _ \ / _ \ / _ \| __/ __| __| '__/ _` | '_ \ .
7
+ # \ V / (_| | (_| | | | (_| | | | | |_ | |_) | (_) | (_) | |_\__ \ |_| | | (_| | |_) |
8
8
  # \_/ \__,_|\__, |_| \__,_|_| |_|\__| |____/ \___/ \___/ \__|___/\__|_| \__,_| .__/
9
9
  # |___/ |_|
10
- # Copyright (c) 2017-2020 Sebastien Varrette <sebastien.varrette@uni.lu>
10
+ # Copyright (c) 2017-2023 Sebastien Varrette
11
11
  ###########################################################################################
12
12
  # (prefered) way to see a Vagrant box configured.
13
13
  #
@@ -26,12 +26,12 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
26
26
  MOTD="/etc/motd"
27
27
  DOTFILES_DIR='/etc/dotfiles.d'
28
28
  DOTFILES_URL='https://github.com/ULHPC/dotfiles.git'
29
- EXTRA_PACKAGES=
29
+ EXTRA_PACKAGES='swtpm swtpm-tools'
30
30
 
31
31
  TITLE=$(hostname -s)
32
32
 
33
33
  # List of default packages to install
34
- COMMON_DEFAULT_PACKAGES="ruby wget figlet git screen bash-completion rsync vim htop net-tools mailx"
34
+ COMMON_DEFAULT_PACKAGES="ruby wget figlet git screen bash-completion rsync vim htop net-tools"
35
35
 
36
36
  ######
37
37
  # Print information in the following form: '[$2] $1' ($2=INFO if not submitted)
@@ -67,6 +67,15 @@ setup_redhat() {
67
67
  touch /etc/sysconfig/bash-prompt-screen
68
68
  chmod +x /etc/sysconfig/bash-prompt-screen
69
69
 
70
+ if [ -x "/usr/bin/crb" ]; then
71
+ info "Enable CodeReady Builder (CRB) repository"
72
+ /usr/bin/crb enable
73
+ fi
74
+
75
+ if ! grep -e "fastestmirror" /etc/dnf/dnf.conf; then
76
+ echo "fastestmirror=1" >> /etc/dnf/dnf.conf
77
+ fi
78
+
70
79
  info "Running yum update"
71
80
  yum update -y >/dev/null
72
81
 
@@ -81,17 +90,24 @@ setup_redhat() {
81
90
  os_version=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
82
91
  info "Adding Puppet Labs repo and installing Puppet for RHEL/CentOS ${os_version}"
83
92
  # Get the major version
84
- yum install -y https://yum.puppetlabs.com/puppet-release-el-$(echo $os_version | cut -d '.' -f 1).noarch.rpm
93
+ yum install -y https://yum.puppetlabs.com/puppet7-release-el-$(echo $os_version | cut -d '.' -f 1).noarch.rpm
85
94
  yum install -y puppet
86
95
  }
87
96
 
88
97
  setup_apt() {
98
+ export DEBIAN_FRONTEND=noninteractive
99
+
89
100
  case $1 in
90
101
  3*) codename=cumulus ;;
91
102
  6) codename=squeeze ;;
92
103
  7) codename=wheezy ;;
93
104
  8) codename=jessie ;;
94
105
  9) codename=stretch ;;
106
+ 10) codename=buster ;;
107
+ 11) codename=bullseye ;;
108
+ 12) codename=bookworm ;;
109
+ 13) codename=trixie ;;
110
+ 14) codename=forky ;;
95
111
  12.04) codename=precise ;;
96
112
  14.04) codename=trusty ;;
97
113
  16.04) codename=xenial ;;
@@ -104,13 +120,12 @@ setup_apt() {
104
120
  info "Installing default packages"
105
121
  apt-get install -y ${COMMON_DEFAULT_PACKAGES} git-core ${EXTRA_PACKAGES} >/dev/null
106
122
 
107
- info "Installing Puppet and its dependencies"
108
- apt-get install puppet-agent -y >/dev/null
109
- apt-get install apt-transport-https -y >/dev/null
123
+ info "Set locale"
124
+ localectl set-locale LANG=en_US.UTF-8
125
+
126
+ info "Installing puppet"
127
+ apt-get install -y puppet >/dev/null
110
128
 
111
- info "installing Environment modules and LMod"
112
- apt-get install -y environment-modules lmod
113
- apt-get install -y build-essentials
114
129
  }
115
130
 
116
131
  setup_linux() {
@@ -144,7 +159,7 @@ setup_linux() {
144
159
  info "Detected Linux distro: ${distro} version ${majver} on arch ${ARCH}"
145
160
  case "$distro" in
146
161
  debian|ubuntu) setup_apt $majver ;;
147
- redhat|fedora|centos|scientific|amazon) setup_redhat $majver ;;
162
+ redhat|rocky|fedora|centos|almalinux|scientific|amazon) setup_redhat $majver ;;
148
163
  *) echo "Not supported distro: $distro"; exit 1;;
149
164
  esac
150
165
 
@@ -169,6 +184,9 @@ setup_dotfiles () {
169
184
  info "installing dotfiles for 'vagrant' user"
170
185
  sudo -u vagrant ${dotfile_install_cmd}
171
186
  fi
187
+ info "cleanup .inputrc"
188
+ rm -f /root/.inputrc
189
+ sudo -u vagrant rm -f ~vagrant/.inputrc
172
190
  }
173
191
 
174
192
  setup_motd() {