FAQ
*******

一般的なトラブルシューティング
================================

サービスの起動ができない
---------------------------

`systemctl start osstech-unicornidm` を実行したあとに
`systemctl status osstech-unicornidm` でサービス起動が失敗している場合、
以下のコマンドで原因が確認できます。

.. code-block:: shell-session

    # journalctl -xe | grep unicornidm-server

たとえば、以下のような出力が得られます。
Traceback 行以下が Python のトレースバックを示します。

この場合、 FileNotFoundError がエラーの原因のようですので、
設定ファイルに記述したファイルパスが存在するか確認する必要があります。

::

    ..
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: Traceback (most recent call last):
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/wsgi.py", line 8, in <module>
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: Conf.parse_config()
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/conf.py", line 57, in parse_config
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: cls._parse_backends(conf)
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/conf.py", line 230, in _parse_backends
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: _params = module.parse_config(section)
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/debug.py", line 22, in __wrapper
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: ret_value = func(*args, **kwargs)
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/backend/ldap.py", line 67, in parse_config
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: 'bind_password': read_file(section['bind_password_file'], strip=True),  # Required
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: File "/opt/osstech/lib/unicornidm/unicornidm/utils.py", line 106, in read_file
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: with open(file_name, 'r') as f:
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: FileNotFoundError: [Errno 2] No such file or directory: '/opt/osstech/etc/unicornidm/secrets/ldap1.password'
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: unable to load app 0 (mountpoint='') (callable not found or import error)
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: *** no app loaded. GAME OVER ***
    5月 11 12:07:52 test-el7 unicornidm-server[22397]: unicornidm-server terminated!!: See "journalctl -xe" or some output for details.

Bad Request (400) が表示される
-------------------------------

Unicorn ID Manager はデフォルトで *localhost* 、
*127.0.0.1* および *サーバーの FQDN ホスト名* でのアクセスしか許可しません。
これらのアクセスに加えて別のホスト名でのアクセスを許可するためには、
ALLOWED_HOSTS 環境変数を指定して Unicorn ID Manager を起動する必要があります。

環境変数の設定は以下のコマンドを実行し、

.. code-block:: shell-session

    # systemctl edit osstech-unicornidm


以下のように *Environment* パラメーターに **ALLOWED_HOSTS=host1:host2:..**
のように記述します。 ALLOWED_HOSTS の値は **:** 区切りで記述します。

.. code-block:: cfg

    [Service]
    Environment="ALLOWED_HOSTS=host1:host2"
