Unable to deploy DevStack on Ubuntu 22.04 - openstack

I'm trying to deploy OpenStack using DevStack on Ubuntu 22.04, I'am facing issues on running stack.sh.
I'm not sure if it's related to the git repo code or related to the system configuration or som missing packages, please advise.
Here below the error log:
fatal: your current branch 'master' does not have any commits yet
+functions-common:git_clone:680 cd /opt/stack/devstack
+lib/neutron-legacy:install_mutnauq:469 setup_develop /opt/stack/neutron
+inc/python:setup_develop:334 local bindep
+inc/python:setup_develop:335 [[ /opt/stack/neutron == -bindep* ]]
+inc/python:setup_develop:339 local project_dir=/opt/stack/neutron
+inc/python:setup_develop:340 local extras=
+inc/python:setup_develop:341 _setup_package_with_constraints_edit /opt/stack/neutron -e
+inc/python:_setup_package_with_constraints_edit:360 local bindep
+inc/python:_setup_package_with_constraints_edit:361 [[ /opt/stack/neutron == -bindep* ]]
+inc/python:_setup_package_with_constraints_edit:365 local project_dir=/opt/stack/neutron
+inc/python:_setup_package_with_constraints_edit:366 local flags=-e
+inc/python:_setup_package_with_constraints_edit:367 local extras=
++inc/python:_setup_package_with_constraints_edit:374 cd /opt/stack/neutron
++inc/python:_setup_package_with_constraints_edit:374 pwd
+inc/python:_setup_package_with_constraints_edit:374 project_dir=/opt/stack/neutron
+inc/python:_setup_package_with_constraints_edit:376 '[' -n /opt/stack/requirements ']'
+inc/python:_setup_package_with_constraints_edit:380 local name
++inc/python:_setup_package_with_constraints_edit:381 awk '/^name.*=/ {print $3}' /opt/stack/neutron/setup.cfg
awk: fatal: cannot open file `/opt/stack/neutron/setup.cfg' for reading: No such file or directory
+inc/python:_setup_package_with_constraints_edit:381 name=
+inc/python:_setup_package_with_constraints_edit:1 exit_trap
+./stack.sh:exit_trap:516 local r=2
++./stack.sh:exit_trap:517 jobs -p
+./stack.sh:exit_trap:517 jobs=
+./stack.sh:exit_trap:520 [[ -n '' ]]
+./stack.sh:exit_trap:526 '[' -f '' ']'
+./stack.sh:exit_trap:531 kill_spinner
+./stack.sh:kill_spinner:426 '[' '!' -z '' ']'
+./stack.sh:exit_trap:533 [[ 2 -ne 0 ]]
+./stack.sh:exit_trap:534 echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:536 type -p generate-subunit
+./stack.sh:exit_trap:537 generate-subunit 1656624514 146 fail
+./stack.sh:exit_trap:539 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:542 /usr/bin/python3.10 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
/opt/stack/devstack/tools/worlddump.py:22: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils import spawn
Any clue ?

Related

How to migrate from Nexus Repository to JFrog Artifactory?

I have two servers, one with Nexus Repository and one with JFrog Artifactory OSS.
I would like to migrate to JFrog Artifactory but because it is open source there is no tool to migrate. If it were the pro version I could migrate easily.
I need some idea how to migrate from Nexus Repository to JFrog Artifactory OSS.
The way that I accomplished this task was to:
manually download the repos from Nexus. For nexus2 you can directly copy the repos from the filesystem. For nexus3 you will need to use the API. For nexus3 I used a script that I will put below.
Zip the repos into a folder
Upload the zipped file to artifactory with their import tool. Go to admin panel, artifactory, import, repositories.
You should be good to go from there more or less. I had to manually set some permissions and snapshot settings.
WARNING! This script doesn't work 100% you may/will have to modify it. WARNING!
sourceServer=
sourceRepo=
sourceUser=
sourcePassword=
logfile=$sourceRepo-backup.log
outputFile=$sourceRepo-artifacts.txt
# ======== GET DOWNLOAD URLs =========
url=$sourceServer"/service/rest/v1/assets?repository="$sourceRepo
contToken="initial"
while [ ! -z "$contToken" ]; do
if [ "$contToken" != "initial" ]; then
url=$sourceServer"/service/rest/v1/assets?continuationToken="$contToken"&repository="$sourceRepo
fi
echo Processing repository token: $contToken | tee -a $logfile
response=`curl -ksSL -u "$sourceUser:$sourcePassword" -X GET --header 'Accept: application/json' "$url"`
readarray -t artifacts < <( jq '[.items[].downloadUrl]' <<< "$response" )
printf "%s\n" "${artifacts[#]}" > artifacts.temp
sed 's/\"//g' artifacts.temp > artifacts1.temp
sed 's/,//g' artifacts1.temp > artifacts.temp
sed 's/[][]//g' artifacts.temp > artifacts1.temp
cat artifacts1.temp >> $outputFile
#for filter in "${filters[#]}"; do
# cat artifacts.temp | grep "$filter" >> $outputFile
#done
#cat maven-public-artifacts.txt
contToken=( $(echo $response | sed -n 's|.*"continuationToken" : "\([^"]*\)".*|\1|p') )
done
# ======== DOWNLOAD EVERYTHING =========
echo Downloading artifacts...
urls=($(cat $outputFile)) > /dev/null 2>&1
for url in "${urls[#]}"; do
path=${url#http://*:*/*/*/}
dir=$sourceRepo"/"${path%/*}
mkdir -p $dir
cd $dir
pwd
curl -vks -u "$sourceUser:$sourcePassword" -D response.header -X GET "$url" -O >> /dev/null 2>&1
responseCode=`cat response.header | sed -n '1p' | cut -d' ' -f2`
if [ "$responseCode" == "200" ]; then
echo Successfully downloaded artifact: $url
else
echo ERROR: Failed to download artifact: $url with error code: $responseCode
fi
rm response.header > /dev/null 2>&1
cd $curFolder
done

Could not build docker image with airflow2.0.0 using breeze

I get below error when tried to run the following breeze build command to build airflow docker. I clone the git airflow master branch to build this image.
Build Command:
./breeze build-image --production-image --python 3.7 --install-airflow-version 2.0.0 --additional-extras=jdbc --additional-python-deps="pandas" --additional-runtime-apt-deps="default-jre-headless"
Error:
Step 83/94 : COPY scripts/docker/install*.sh /scripts/docker/
---> 8363694670bb
Step 84/94 : RUN if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then bash /scripts/docker/install_airflow.sh; fi; if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then bash /scripts/docker/install_from_docker_context_files.sh; fi; if [[ -n "${ADDITIONAL_PYTHON_DEPS}" ]]; then bash /scripts/docker/install_additional_dependencies.sh; fi; find /root/.local/ -name '*.pyc' -print0 | xargs -0 rm -r || true ; find /root/.local/ -type d -name '__pycache__' -print0 | xargs -0 rm -r || true
---> Running in 01f3dd4b7f57
+ [[ true == \t\r\u\e ]]
+ bash /scripts/docker/install_airflow.sh
Installing all packages with constraints and upgrade if needed
ERROR: Invalid requirement: 'apache-airflow[async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,microsoft.azure,mysql,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv,jdbc]2.0.0'
WARNING: You are using pip version 20.2.4; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
The command '/bin/bash -o pipefail -e -u -x -c if [[ ${INSTALL_FROM_PYPI} == "true" ]]; then bash /scripts/docker/install_airflow.sh; fi; if [[ ${INSTALL_FROM_DOCKER_CONTEXT_FILES} == "true" ]]; then bash /scripts/docker/install_from_docker_context_files.sh; fi; if [[ -n "${ADDITIONAL_PYTHON_DEPS}" ]]; then bash /scripts/docker/install_additional_dependencies.sh; fi; find /root/.local/ -name '*.pyc' -print0 | xargs -0 rm -r || true ; find /root/.local/ -type d -name '__pycache__' -print0 | xargs -0 rm -r || true' returned a non-zero code: 1
ERROR: The previous step completed with error. Please take a look at output above
Edit (1):
I tried the same thing on an aws ec2 instance and get the same error. Something looks like is broken on the airflow side. Below is the screenshot.
Replace
--install-airflow-version 2.0.0
with
--install-airflow-version="2.0.0"
So the command is:
./breeze build-image --production-image --python 3.7 --install-airflow-version "2.0.0" --additional-extras=jdbc --additional-python-deps="pandas" --additional-runtime-apt-deps="default-jre-headless"
This worked for me:
./breeze build-image --production-image --python 3.7 --install-airflow-version "==2.0.0" --additional-extras=jdbc --additional-python-deps="pandas" --additional-runtime-apt-deps="default-jre-headless"
had to add the "==".

Devstack installation error sudo systemctl start devstack#sl-api.service

These are the devstack logs appears on the screen
++functions-common:write_uwsgi_user_unit_file:1480 iniset -sudo /etc/systemd/system/devstack#sl-api.service Install WantedBy multi-user.target
++functions-common:write_uwsgi_user_unit_file:1483 sudo systemctl daemon-reload
++functions-common:_run_under_systemd:1530 sudo systemctl enable devstack#sl-api.service
Created symlink /etc/systemd/system/multi-user.target.wants/devstack#sl-api.service → /etc/systemd/system/devstack#sl-api.service.enter code here
++functions-common:_run_under_systemd:1531 sudo systemctl start devstack#sl-api.service
Job for devstack#sl-api.service failed because the control process exited with error code.
See "systemctl status devstack#sl-api.service" and "journalctl -xe" for details.
+functions-common:_run_under_systemd:1 exit_trap
+./stack.sh:exit_trap:489 local r=1
++./stack.sh:exit_trap:490 jobs -p
+./stack.sh:exit_trap:490 jobs=
+./stack.sh:exit_trap:493 [[ -n '' ]]
+./stack.sh:exit_trap:499 '[' -f /tmp/tmp.g8xjCU2yg2 ']'
+./stack.sh:exit_trap:500 rm /tmp/tmp.g8xjCU2yg2
+./stack.sh:exit_trap:504 kill_spinner
+./stack.sh:kill_spinner:399 '[' '!' -z '' ']'
+./stack.sh:exit_trap:506 [[ 1 -ne 0 ]]
+./stack.sh:exit_trap:507 echo 'Error on exit'
Error on exit
+./stack.sh:exit_trap:509 type -p generate-subunit
+./stack.sh:exit_trap:510 generate-subunit 1593717952 1120 fail
+./stack.sh:exit_trap:512 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:515 /usr/bin/python3.6 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
nova-compute: no process found
neutron-dhcp-agent: no process found
neutron-l3-agent: no process found
neutron-metadata-agent: no process found
neutron-openvswitch-agent: no process found
+./stack.sh:exit_trap:524 exit 1
stack#opstack:~/devstack$
cd /etc/systemd/system/
vi systemctl start devstack#sl-api.service
ExecStart = /usr/local/bin/uwsgi --procname-prefix senlin-api --ini /etc/senlin/senlin-api-uwsgi.ini
file not exist
/usr/local/bin/uwsgi
cd /usr/bin
ls | grep uwsgi
if file is here then use if you don't have it here then you can reinstall using apt-get install uwsgi or pip install uwsgi
cd /usr/local/bin
ln -s /usr/bin/uwsgi uwsgi
./unstack.sh
./stach.sh
here we go.....

Startup script generated by SBT packager doesn't work

I have an SBT project that uses a pure-Java plugin to create a Debian package. The plugin is defined in plugins.sbt as such:
libraryDependencies += "org.vafer" % "jdeb" % "1.5" artifacts (Artifact("jdeb", "jar", "jar"))
In the SBT console, I execute this command:
debian:packageBin
This generates a .deb file which I am attempting to install on an Ubuntu machine using dpkg -i <filename>
The package installs. The libraries and configuration etc. are placed in /usr/share/, which is what I expected. That folder also includes a bin folder with a script that directly starts the program. So far so good.
However, I want to start the program using service start <projectname>, which doesn't work. Same goes for /etc/init.d/<projectname> start. The output for the latter command is:
[ ok ] Starting undagrid-api-server (via systemctl): undagrid-api-server.service.
But the process isn't running when I check it with ps. Here's the contents of /etc/init.d/<projectname>
#! /bin/bash
### BEGIN INIT INFO
# Provides: <projectname>
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: <projectname>
### END INIT INFO
source /lib/init/vars.sh
source /lib/lsb/init-functions
# adding bashScriptEnvConfigLocation
[[ -f /etc/default/<projectname> ]] && . /etc/default/<projectname>
# $JAVA_OPTS used in $RUN_CMD wrapper
export JAVA_OPTS
PIDFILE=/var/run/<projectname>/running.pid
if [ -z "$DAEMON_USER" ]; then
DAEMON_USER=<projectname>
fi
if [ -z "$DAEMON_GROUP" ]; then
DAEMON_GROUP=<projectname>
fi
RUN_CMD="/usr/share/<projectname>/bin/<projectname>"
start_daemon() {
log_daemon_msg "Starting" "<projectname>"
[ -d "/var/run/<projectname>" ] || install -d -o "$DAEMON_USER" -g "$DAEMON_GROUP" -m755 "/var/run/<projectname>"
start-stop-daemon --background --chdir /usr/share/<projectname> --chuid "$DAEMON_USER" --make-pidfile --pidfile "$PIDFILE" --startas "$RUN_CMD" --start -- $RUN_OPTS
log_end_msg $?
}
stop_daemon() {
log_daemon_msg "Stopping" "<projectname>"
start-stop-daemon --stop --quiet --oknodo --pidfile "$PIDFILE" --retry=TERM/60/KILL/30
log_end_msg $?
rm -f "$PIDFILE"
}
case "$1" in
start)
start_daemon
exit $?
;;
stop)
stop_daemon
exit $?
;;
restart|force-reload)
stop_daemon
start_daemon
exit $?
;;
status)
status_of_proc -p "$PIDFILE" "$RUN_CMD" <projectname> && exit 0 || exit $?
;;
*)
log_daemon_msg "Usage: /etc/init.d/<projectname> {start|stop|restart|status}"
;;
esac
exit 0
With some simple debugging I have found out that if the command line argument is "start", the script never makes it past the second source statement: source /lib/lsb/init-functions
Systemctl gives me the following output:
<projectname>.service loaded active exited LSB: <projectname>
I have also run the script using bash -x but that produces quite a pile of output that I don't really know how to read.
Anybody know what's going on here? The entire point of using a packager and installing it as a package is to avoid headaches like these...

.zshrc unrecognized condition on $-

I'm attempting to port over some functionality from my old .bashrc into my .zshrc and I'm having trouble with a condition that worked in bash.
Whenever I remote log in to my computer, I had bash check the $- variable to see if it was interactive. If it was, I would start up an emacs server if one wasn't already running and change to my code directory. Otherwise (if I was getting a file with scp, for example), I wouldn't do anything.
Here's the bit of code:
if [[ $- -regex-match "i" ]]; then
ps -u myusername | grep emacs > /dev/null
if [ $? -eq 0 ]; then
echo "emacs server already running"
else
emacsserver
fi
aliastocdtomydirectory
fi
And here's the error zsh gives me: .zshrc:125: unrecognized condition:$-'`
Does anyone know how to get around this error when using $- ? I've tried quoting it, wrapping it in $(echo $-) but none have worked. Thanks in advance.
Edit: If I switch my code to:
if [[ $- =~ "i" ]]; then
ps -u myusername | grep emacs > /dev/null
if [ $? -eq 0 ]; then
echo "emacs server already running"
else
emacsserver
fi
aliastocdtomydirectory
fi
I now get: .zshrc:125: condition expected: =~ I'm not sure exactly what zsh is interpreting incorrectly here as I'm not very familiar with the semantics of zsh's shell scripts. Could someone point me in the right direction on how to express this condition in zsh?
In zsh, you don't need to bother with $-, which is--I think--intended primarily for POSIX compatibility.
if [[ -o INTERACTIVE ]]; then
if ps -u myusername | grep -q emacs; then
echo "emacs server already running"
else
emacsserver
fi
aliastocdtomydirectory
fi
-regex-match is only available if tho module zsh/regex (man 1 zshmodules) is loaded. (The error message depends on the version: I get zsh: unknown condition: -regex-match if it is not loaded on 4.3.17, but zsh:1: unknown condition: -$- on 4.3.10).
You can try [[ $- =~ "i" ]] which is not dependend on additional modules.

Resources