Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-2985

bash gets confused by the content of DJANGO_SECRET

    XMLWordPrintable

    Details

      Description

      When updating from 3.6.0 to 3.6.1 (snapshot) via OBS, I observed the following strange output:

      (1/4) Installing: openattic-3.6.1~201712111143-48.1.noarch ...............[done]
      Additional rpm output:
      openattic group already exists
      openattic user already exists
      Updating /etc/sysconfig/openattic...
      
      
      (2/4) Installing: openSUSE-release-ftp-42.3-1.202.x86_64 .................[done]
      (3/4) Installing: libtxc_dxtn-1.0.1-3.1.x86_64 ...........................[done]
      (4/4) Installing: lifecycle-data-openSUSE-1-5.1.noarch ...................[done]
      Output of openattic-3.6.1~201712111143-48.1.noarch.rpm %posttrans script:
          /etc/sysconfig/openattic: line 90: w^[: command not found
          Database openattic exists, owned by  openattic 
          /etc/sysconfig/openattic: line 90: w^[: command not found
          Reading settings from /etc/sysconfig/openattic
          DROP DATABASE
          CREATE DATABASE
          Creating tables ...
          Creating table auth_permission
          Creating table auth_group_permissions
          Creating table auth_group
          Creating table auth_user_groups
          Creating table auth_user_user_permissions
          Creating table auth_user
          Creating table django_content_type
          Creating table django_session
          Creating table django_site
          Creating table django_admin_log
          Creating table authtoken_token
          Creating table userprefs_userprofile
          Creating table userprefs_userpreference
          Creating table ceph_cephcluster
          Creating table ceph_cephpool
          Creating table ceph_cepherasurecodeprofile
          Creating table ceph_cephosd
          Creating table ceph_cephpg
          Creating table ceph_cephrbd
          Creating table ceph_cephfs
          Creating table ceph_crushmapversion
          Creating table ceph_iscsi_iscsiinterface
          Creating table ceph_iscsi_iscsitarget
          Creating table ceph_nfs_ganeshaexport
          Creating table taskqueue_taskqueue
          Installing custom SQL ...
          Installing indexes ...
          inserting INSERT INTO auth_user (username, first_name, last_name, is_active, id, is_superuser, is_staff, last_login, password, email, date_joined) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
          Setting sequence `auth_user_id_seq` of table `auth_user` to `2`
          inserting INSERT INTO authtoken_token (user_id, key, created) VALUES (%s, %s, %s);
          inserting INSERT INTO userprefs_userprofile (user_id, id) VALUES (%s, %s);
          Setting sequence `userprefs_userprofile_id_seq` of table `userprefs_userprofile` to `2`
          Setting sequence `userprefs_userpreference_id_seq` of table `userprefs_userpreference` to `1`
          /etc/sysconfig/openattic: line 90: w^[: command not found
          Reading settings from /etc/sysconfig/openattic
          We have an admin already, not creating default user.
          The authentication token for 'openattic' does already exist.
          Completed successfully.
      
      There are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run 'zypper ps -s' to list these programs.
      

      The command not found error comes from oaconfig install:

      leap-423:~ # sh -x /usr/sbin/oaconfig install
      + export OACONFIG=True
      + OACONFIG=True
      + for settings in '"/etc/default/openattic"' '"/etc/sysconfig/openattic"'
      + '[' -f /etc/default/openattic ']'
      + for settings in '"/etc/default/openattic"' '"/etc/sysconfig/openattic"'
      + '[' -f /etc/sysconfig/openattic ']'
      + . /etc/sysconfig/openattic
      ++ OAUSER=openattic
      ++ OAGROUP=openattic
      ++ PYTHON=/usr/bin/python
      ++ OADIR=/usr/share/openattic
      ++ WEBSERVER_SERVICE=apache2
      ++ SALT_API_HOST=salt
      ++ SALT_API_PORT=8000
      ++ SALT_API_EAUTH=sharedsecret
      ++ SALT_API_USERNAME=admin
      ++ SALT_API_PASSWORD=admin
      ++ SALT_API_SHARED_SECRET=
      ++ RGW_API_HOST=
      ++ RGW_API_PORT=80
      ++ RGW_API_ACCESS_KEY=
      ++ RGW_API_SECRET_KEY=
      ++ RGW_API_ADMIN_RESOURCE=admin
      ++ RGW_API_USER_ID=
      ++ RGW_API_SCHEME=http
      ++ GRAFANA_API_HOST=localhost
      ++ GRAFANA_API_PORT=3000
      ++ GRAFANA_API_USERNAME=admin
      ++ GRAFANA_API_PASSWORD=admin
      ++ GRAFANA_API_SCHEME=http
      +++ 'w^['
      /etc/sysconfig/openattic: line 90: w^[: command not found
      ++ DJANGO_SECRET='n;aLDmKG<Kh3>Ko^rhH5)]z}~f\>P9WcG25j/30)'\''0^hP'
      + [[ -z openattic ]]
      + [[ -z /usr/share/openattic ]]
      + [[ -e /usr/share/openattic ]]
      + cd /usr/share/openattic
      + '[' '' = 1 ']'
      + set -e
      + set -u
      + '[' 1 = 0 ']'
      + case $1 in
      + service postgresql status
      + database_ini=/etc/openattic/database.ini
      ++ sed -rn 's/^[[:blank:]]*host[[:blank:]]*=[[:blank:]]*(.*)[[:blank:]]*/\1/p' /etc/openattic/database.ini
      + host=localhost
      + '[' localhost == localhost ']'
      + has_local_database=1
      ++ sed -rn 's/[[:blank:]]*name[[:blank:]]*=[[:blank:]]*(.*)[[:blank:]]*/\1/p' /etc/openattic/database.ini
      + db_name=openattic
      + [[ -z openattic ]]
      ++ sed -rn 's/[[:blank:]]*user[[:blank:]]*=[[:blank:]]*(.*)[[:blank:]]*/\1/p' /etc/openattic/database.ini
      + db_user=openattic
      + [[ -z openattic ]]
      + ((  has_local_database  ))
      + sql='SELECT 1 FROM pg_roles WHERE rolname='\''openattic'\'''
      + grep -q 1
      + su - postgres -c 'psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='\''openattic'\''"'
      ++ awk '-F|' ' /openattic/ { print $2 }'
      ++ su - postgres -c 'psql --list'
      + dbu=' openattic '
      + '[' -n ' openattic ' ']'
      + echo 'Database openattic exists, owned by  openattic '
      Database openattic exists, owned by  openattic 
      ++ sed -rn 's/^[[:blank:]]*password[[:blank:]]*=[[:blank:]]*(.*)[[:blank:]]*/\1/p' /etc/openattic/database.ini
      + password=024550f2d45e10ed75d2
      + PGPASSWORD=024550f2d45e10ed75d2
      + psql openattic openattic -h localhost --no-password -c '\q'
      + /usr/sbin/oaconfig stop
      /etc/sysconfig/openattic: line 90: w^[: command not found
      + python manage.py install --pre-install
      Reading settings from /etc/sysconfig/openattic
      DROP DATABASE
      CREATE DATABASE
      Creating tables ...
      Creating table auth_permission
      Creating table auth_group_permissions
      Creating table auth_group
      Creating table auth_user_groups
      Creating table auth_user_user_permissions
      Creating table auth_user
      Creating table django_content_type
      Creating table django_session
      Creating table django_site
      Creating table django_admin_log
      Creating table authtoken_token
      Creating table userprefs_userprofile
      Creating table userprefs_userpreference
      Creating table ceph_cephcluster
      Creating table ceph_cephpool
      Creating table ceph_cepherasurecodeprofile
      Creating table ceph_cephosd
      Creating table ceph_cephpg
      Creating table ceph_cephrbd
      Creating table ceph_cephfs
      Creating table ceph_crushmapversion
      Creating table ceph_iscsi_iscsiinterface
      Creating table ceph_iscsi_iscsitarget
      Creating table ceph_nfs_ganeshaexport
      Creating table taskqueue_taskqueue
      Installing custom SQL ...
      Installing indexes ...
      inserting INSERT INTO auth_user (username, first_name, last_name, is_active, id, is_superuser, is_staff, last_login, password, email, date_joined) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
      Setting sequence `auth_user_id_seq` of table `auth_user` to `2`
      inserting INSERT INTO authtoken_token (user_id, key, created) VALUES (%s, %s, %s);
      inserting INSERT INTO userprefs_userprofile (user_id, id) VALUES (%s, %s);
      Setting sequence `userprefs_userprofile_id_seq` of table `userprefs_userprofile` to `2`
      Setting sequence `userprefs_userpreference_id_seq` of table `userprefs_userpreference` to `1`
      + /usr/sbin/oaconfig start
      /etc/sysconfig/openattic: line 90: w^[: command not found
      + su openattic -c 'python manage.py install --post-install'
      Reading settings from /etc/sysconfig/openattic
      We have an admin already, not creating default user.
      The authentication token for 'openattic' does already exist.
      + echo 'Completed successfully.'
      Completed successfully.
      

      Line 90 in /etc/sysconfig/openattic contains the newly added DJANGO_SECRET:

      leap-423:~ # grep DJANGO_SECRET /etc/sysconfig/openattic
      DJANGO_SECRET="n;aLDmKG<Kh3>Ko^rhH5)]z}~f\>P9WcG25j/`w^[`30)'0^hP"
      

        Attachments

          Activity

            People

            • Assignee:
              lgrimmer Grimmer, Lenz
              Reporter:
              lgrimmer Grimmer, Lenz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: