Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

/opt/kitchen/run_command formatting causing start of chef-client to fail. #229

Closed
Bob-at-RH opened this issue Apr 13, 2021 · 0 comments
Closed

Comments

@Bob-at-RH
Copy link

Bob-at-RH commented Apr 13, 2021

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

kitchen-dokken converge is failing to complete

Version

PS C:\Users\robbro04> chef gem list kitchen-dokken

*** LOCAL GEMS ***

kitchen-dokken (2.12.1)

Environment

PS C:\Users\robbro04> chef --version
Chef Workstation version: 21.4.365
Chef Infra Client version: 16.12.3
Chef InSpec version: 4.29.3
Chef CLI version: 4.0.0
Chef Habitat version: 1.6.288
Test Kitchen version: 2.11.2
Cookstyle version: 7.10.0

robbro04@SRM-LT-X1504 MINGW64 /c/Users/robbro04/cookbooks/linux_ad (master)
$ docker --version
Docker version 20.10.5, build 55c4c88

Here's my kitchen.yaml file:

---
driver:
  name: dokken
  chef_version: 15
  privileged: true
  # product_name: chef
  # product_version: 14
  customize:
    memory: '512'

transport:  dokken

provisioner:
  name: dokken
  deprecations_as_errors: true

# provisioner:
#   name: chef_zero
#   always_update_cookbooks: true
#   product_name: chef
#   product_version: 13
#   install_strategy: always
#   log_level: info

verifier:
  name: inspec
  # socket: tcp://localhost:2375

platforms:
  # - name: centos-7
  #   driver:
  #     image: dokken/centos-7
  - name: centos-7
    driver:
      image: dokken/centos-7
      platform: rhel
      privileged: true
      pid_one_command: /usr/lib/systemd/systemd
      intermediate_instructions:
        - RUN yum clean all
        - RUN yum -y install net-tools lsof
      volumes:
        - /sys/fs/cgroup:/sys/fs/cgroup:ro # required by systemd
  # - name: centos-8
  #   driver:
  #     image: dokken/centos-8
  - name: centos-8
    driver:
      image: dokken/centos-8
      platform: rhel
      privileged: true
      pid_one_command: /usr/lib/systemd/systemd
      intermediate_instructions:
        - RUN yum clean all
        - RUN yum -y install net-tools lsof
      volumes:
        - /sys/fs/cgroup:/sys/fs/cgroup:ro # required by systemd

suites:
  - name: default
    run_list:
      - recipe[linux_ad::default]
    verifier:
      inspec_tests:
        - test/integration/default
    attributes:
      ad:
        dyndns:
          include: true
      windows:
        domain:
          name: na.msds.rhi.com
          ou: OU=OBS-SCH,OU=ITESS,OU=Server,OU=Resources,DC=na,DC=msds,DC=rhi,DC=com
          user: svcJoinNAOBS
          password: ************************************* **{redacted for security}**
          # password: ssm:///roberthalf/active-directory/NA/svcjoinNAOBS?region=us-west-2
          security_groups:
        groups:
          Administrators:
            members: aarobbro04@na.msds.rhi.com,aajimrut01@na.msds.rhi.com,aalilasm01@na.msds.rhi.com,aasusyua01@na.msds.rhi.com
          Users:
            members: robbro04@na.msds.rhi.com,jimrut01@na.msds.rhi.com,lilasm01@na.msds.rhi.com,susyua01@na.msds.rhi.com

Scenario

I need kitchen converge for centos-7 and centos-8 to work. I am attempting to get a pipeline going for the cookbook.

Steps to Reproduce

example:
kitchen converge

Expected Result

Converge of the cookbook should at least start (I fully expect it to fail since it's not been converged in a docker based environment before).

Actual Result

robbro04@SRM-LT-X1504 MINGW64 /c/Users/robbro04/cookbooks/linux_ad (master)
$ kitchen converge
-----> Starting Test Kitchen (v2.11.2)
-----> Converging <default-centos-7>...
       Creating kitchen sandbox in C:/temp/.dokken/kitchen_sandbox/245cf12fe6-default-centos-7
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 7.2.0...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
       Transferring files to <default-centos-7>
sh: $'\r': command not found
': not a valid identifier_KITCHEN
"2021-04-13T19:00:34+00:00] FATAL: Invalid argument; could not find the following recipe files: "
-----> Converging <default-centos-8>...
       Creating kitchen sandbox in C:/temp/.dokken/kitchen_sandbox/245cf12fe6-default-centos-8
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 7.2.0...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
       Transferring files to <default-centos-8>
sh: $'\r': command not found
': not a valid identifier_KITCHEN
"2021-04-13T19:01:22+00:00] FATAL: Invalid argument; could not find the following recipe files: "
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 2 actions failed.
>>>>>>     Converge failed on instance <default-centos-7>.  Please see .kitchen/logs/default-centos-7.log for more details
>>>>>>     Converge failed on instance <default-centos-8>.  Please see .kitchen/logs/default-centos-8.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

➕ Additional context

Add any other context about the problem here. e.g. related issues or existing pull requests.

I've tracked it down to /opt/kitchen/run_command not functioning properly - I've manually run the chef-client command and
the command line works, but the extra environment variable and shell encapsulation seems to be the issue for this file. Running dos2unix on /opt/kitchen/run_command allows it to run cleanly. I'm just not sure how the files are created with CRLF vs. LF line endings.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants