Skip to content

Setting gitlab_rails['enable'] = false breaks ssh_keys recipe in EE

Tested in container and vm, the error is:

 * ssh_keygen[/var/opt/gitlab/.ssh/id_rsa] action create
    - Create SSH rsa 2048-bit key (git@2a5ca6ff6bf0)
    * file[/var/opt/gitlab/.ssh/id_rsa] action create
      * Parent directory /var/opt/gitlab/.ssh does not exist.
      ================================================================================
      Error executing action `create` on resource 'file[/var/opt/gitlab/.ssh/id_rsa]'
      ================================================================================

      Chef::Exceptions::EnclosingDirectoryDoesNotExist
      ------------------------------------------------
      Parent directory /var/opt/gitlab/.ssh does not exist.

      Cookbook Trace:
      ---------------
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/libraries/ssh_keygen.rb:164:in `block in save_private_key'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/libraries/ssh_keygen.rb:155:in `save_private_key'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/resources/ssh_keygen.rb:43:in `block in class_from_file'

      Resource Declaration:
      ---------------------
      suppressed sensitive resource output

      Compiled Resource:
      ------------------
      suppressed sensitive resource output

      Platform:
      ---------
      x86_64-linux


    ================================================================================
    Error executing action `create` on resource 'ssh_keygen[/var/opt/gitlab/.ssh/id_rsa]'
    ================================================================================

    Chef::Exceptions::EnclosingDirectoryDoesNotExist
    ------------------------------------------------
    file[/var/opt/gitlab/.ssh/id_rsa] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/libraries/ssh_keygen.rb line 156) had an error: Chef::Excepti$
ns::EnclosingDirectoryDoesNotExist: Parent directory /var/opt/gitlab/.ssh does not exist.

    Cookbook Trace:
    ---------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/libraries/ssh_keygen.rb:164:in `block in save_private_key'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/libraries/ssh_keygen.rb:155:in `save_private_key'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/resources/ssh_keygen.rb:43:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/ssh_keys.rb

     26: ssh_keygen ssh_key_path do
     27:   action :create
     28:   owner gitlab_username
     29:   group gitlab_group
     30:   secure_directory true
     31: end

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/ssh_keys.rb:26:in `from_file'

    ssh_keygen("/var/opt/gitlab/.ssh/id_rsa") do
      action [:create]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :ssh_keygen
      cookbook_name "gitlab-ee"
      recipe_name "ssh_keys"
      owner "git"
      group "git"
      secure_directory true
      path "/var/opt/gitlab/.ssh/id_rsa"
      type "rsa"
      comment "git@2a5ca6ff6bf0"
    end

    Platform:
    ---------
    x86_64-linux