```
I, [2022-01-06T14:57:13.783163 #204691] INFO -- : Catalogs compiled for worker01.softwareheritage.org
I, [2022-01-06T14:57:14.153481 #204691] INFO -- : Diffs computed for worker01.softwareheritage.org
diff origin/production/worker01.softwareheritage.org current/worker01.softwareheritage.org
*******************************************
- File[/etc/systemd/system/opam-manage-shared-state-coq.inria.fr.service]
*******************************************
File[/etc/systemd/system/opam-manage-shared-state-coq.inria.fr.timer] =>
parameters =>
ensure =>
- file
+ absent
*******************************************
- File[/etc/systemd/system/opam-manage-shared-state-ocamlbench-repo.service]
*******************************************
File[/etc/systemd/system/opam-manage-shared-state-ocamlbench-repo.timer] =>
parameters =>
ensure =>
- file
+ absent
*******************************************
- File[/etc/systemd/system/opam-manage-shared-state-opam.ocaml.org.service]
*******************************************
File[/etc/systemd/system/opam-manage-shared-state-opam.ocaml.org.timer] =>
parameters =>
ensure =>
- file
+ absent
*******************************************
+ File[/etc/systemd/system/opam-manage-shared-state.service] =>
parameters =>
"ensure": "file"
"group": "root"
"mode": "0444"
"notify": "Class[Systemd::Systemctl::Daemon_reload]"
"owner": "root"
"show_diff": true
"content": >>>
# Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh
[Install]
WantedBy=multi-user.target
<<<
*******************************************
+ File[/etc/systemd/system/opam-manage-shared-state.timer] =>
parameters =>
"ensure": "file"
"group": "root"
"mode": "0444"
"notify": ["Class[Systemd::Systemctl::Daemon_reload]", "Service[opam-manage-shared-state.timer]"]
"owner": "root"
"show_diff": true
"content": >>>
[Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
Persistent=true
# every ~4h
AccuracySec=4h
RandomizedDelaySec=1200
FixedRandomDelay=true
Unit=.service
[Unit]
Description=Software Heritage Manage OPAM shared state timer
<<<
*******************************************
File[/usr/local/bin/opam-manage-shared-state.sh] =>
parameters =>
content =>
@@ -4,19 +4,50 @@
# Changes will be overwritten
_
-CMD=/usr/bin/opam
+# This script is in charge of bootstraping the opam root folder with the default opam
+# repository.
+
+set -e
+
ROOT_DIR=/tmp/opam/
-DEFAULT_INSTANCE="opam.ocaml.org"
-INSTANCE=$1
-INSTANCE_URL=$2
-
-if [ $INSTANCE = $DEFAULT_INSTANCE ]; then
- # Opam instance is considered the main instance so we must initialize the repository
- # if not present, otherwise we update it
- ( $CMD repo --all --root $ROOT_DIR | grep $INSTANCE_URL && $CMD update --root $ROOT_DIR ) \
- || $CMD init --reinit --bare --no-setup --root $ROOT_DIR $INSTANCE $INSTANCE_URL
-else
- # Other instances, if present should be updated. If not present, they should be added
- # to the main root_dir as extra instances
- ( $CMD repo --all --root $ROOT_DIR | grep $INSTANCE_URL && $CMD update --root $ROOT_DIR ) \
- || $CMD repository add --root $ROOT_DIR $INSTANCE $INSTANCE_URL
-fi
+CMD=/usr/bin/opam
+
+function init_or_update_opam_root () {
+ "Ensure opam root directory exists and references the main opam repository as default
+ instance. If not, create it from scratch. If properly configured, update the opam
+ repository."
+
+ instance_name=$1
+ instance_url=$2
+
+ if $CMD repo --all --root $ROOT_DIR | grep -qx $instance_url; then
+ $CMD update --root $ROOT_DIR
+ else
+ $CMD init --reinit --bare --no-setup --root $ROOT_DIR $instance_name $instance_url
+ fi
+}
+
+function init_or_update_opam_instance () {
+ "Ensure opam root directory exists and references the main opam repository as default
+ instance. If not, create it from scratch. If properly configured, update the opam
+ repository.
+
+ This assumes that the function init_or_update_opam_root already got called prior to
+ calling this one."
+
+ instance_name=$1
+ instance_url=$2
+
+ if $CMD repo --all --root $ROOT_DIR | grep -qx $instance_url; then
+ $CMD update --root $ROOT_DIR
+ else
+ $CMD repository add --root $ROOT_DIR $instance_name $instance_url
+ fi
+}
+
+init_or_update_opam_root opam.ocaml.org https://opam.ocaml.org
+
+
+init_or_update_opam_instance coq.inria.fr https://coq.inria.fr/opam/released
+
+init_or_update_opam_instance ocamlbench-repo https://github.com/OCamlPro/ocamlbench-repo.git
+
*******************************************
Service[opam-manage-shared-state-coq.inria.fr.timer] =>
parameters =>
enable =>
- true
+ false
*******************************************
Service[opam-manage-shared-state-ocamlbench-repo.timer] =>
parameters =>
enable =>
- true
+ false
*******************************************
Service[opam-manage-shared-state-opam.ocaml.org.timer] =>
parameters =>
enable =>
- true
+ false
*******************************************
+ Service[opam-manage-shared-state.timer] =>
parameters =>
"enable": true
"provider": "systemd"
*******************************************
Systemd::Timer[opam-manage-shared-state-coq.inria.fr.timer] =>
parameters =>
enable =>
- true
+ false
ensure =>
- present
+ absent
service_content =>
- # Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state (coq.inria.fr)
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh coq.inria.fr https://coq.inria.fr/opam/released
[Install]
WantedBy=multi-user.target
timer_content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-coq.inria.fr.service
[Unit]
Description=Software Heritage Manage OPAM shared state (coq.inria.fr) timer
*******************************************
Systemd::Timer[opam-manage-shared-state-ocamlbench-repo.timer] =>
parameters =>
enable =>
- true
+ false
ensure =>
- present
+ absent
service_content =>
- # Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state (ocamlbench-repo)
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh ocamlbench-repo https://github.com/OCamlPro/ocamlbench-repo.git
[Install]
WantedBy=multi-user.target
timer_content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-ocamlbench-repo.service
[Unit]
Description=Software Heritage Manage OPAM shared state (ocamlbench-repo) timer
*******************************************
Systemd::Timer[opam-manage-shared-state-opam.ocaml.org.timer] =>
parameters =>
enable =>
- true
+ false
ensure =>
- present
+ absent
service_content =>
- # Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state (opam.ocaml.org)
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh opam.ocaml.org https://opam.ocaml.org
[Install]
WantedBy=multi-user.target
timer_content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-opam.ocaml.org.service
[Unit]
Description=Software Heritage Manage OPAM shared state (opam.ocaml.org) timer
*******************************************
+ Systemd::Timer[opam-manage-shared-state.timer] =>
parameters =>
"enable": true
"ensure": "present"
"group": "root"
"mode": "0444"
"owner": "root"
"path": "/etc/systemd/system"
"show_diff": true
"service_content": >>>
# Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh
[Install]
WantedBy=multi-user.target
<<<
"timer_content": >>>
[Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
Persistent=true
# every ~4h
AccuracySec=4h
RandomizedDelaySec=1200
FixedRandomDelay=true
Unit=.service
[Unit]
Description=Software Heritage Manage OPAM shared state timer
<<<
*******************************************
- Systemd::Unit_file[opam-manage-shared-state-coq.inria.fr.service]
*******************************************
Systemd::Unit_file[opam-manage-shared-state-coq.inria.fr.timer] =>
parameters =>
content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-coq.inria.fr.service
[Unit]
Description=Software Heritage Manage OPAM shared state (coq.inria.fr) timer
enable =>
- true
+ false
ensure =>
- present
+ absent
*******************************************
- Systemd::Unit_file[opam-manage-shared-state-ocamlbench-repo.service]
*******************************************
Systemd::Unit_file[opam-manage-shared-state-ocamlbench-repo.timer] =>
parameters =>
content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-ocamlbench-repo.service
[Unit]
Description=Software Heritage Manage OPAM shared state (ocamlbench-repo) timer
enable =>
- true
+ false
ensure =>
- present
+ absent
*******************************************
- Systemd::Unit_file[opam-manage-shared-state-opam.ocaml.org.service]
*******************************************
Systemd::Unit_file[opam-manage-shared-state-opam.ocaml.org.timer] =>
parameters =>
content =>
- [Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
AccuracySec=4h
Persistent=true
Unit=opam-manage-shared-state-opam.ocaml.org.service
[Unit]
Description=Software Heritage Manage OPAM shared state (opam.ocaml.org) timer
enable =>
- true
+ false
ensure =>
- present
+ absent
*******************************************
+ Systemd::Unit_file[opam-manage-shared-state.service] =>
parameters =>
"ensure": "present"
"group": "root"
"mode": "0444"
"owner": "root"
"path": "/etc/systemd/system"
"show_diff": true
"content": >>>
# Opam manage shared state unit file
# Managed by puppet class profile::swh::deploy::worker::loader_opam
# Changes will be overwritten
[Unit]
Description=Software Heritage Manage OPAM shared state
Requires=network.target
After=network.target
[Service]
User=swhworker
Group=swhworker
Type=simple
ExecStart=/usr/local/bin/opam-manage-shared-state.sh
[Install]
WantedBy=multi-user.target
<<<
*******************************************
+ Systemd::Unit_file[opam-manage-shared-state.timer] =>
parameters =>
"enable": true
"ensure": "present"
"group": "root"
"mode": "0444"
"owner": "root"
"path": "/etc/systemd/system"
"show_diff": true
"content": >>>
[Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
Persistent=true
# every ~4h
AccuracySec=4h
RandomizedDelaySec=1200
FixedRandomDelay=true
Unit=.service
[Unit]
Description=Software Heritage Manage OPAM shared state timer
<<<
*******************************************
*** End octocatalog-diff on worker01.softwareheritage.org
```