packer chef-solo fails with 404 when looks for node

421 views
Skip to first unread message

Max León

unread,
Sep 8, 2016, 10:11:26 PM9/8/16
to Packer
Hi,
I just started to use Packer today and is quite a tool.

I'm having a problem with chef-solo doe and I just cannot make any sense of it, the builder works as expected and I've been able to provide chef-solo with the data_bags, cookbooks, etc... I've also manage to set all the needed variables on a vars file, but when it runs chef-solo is unable to locate the node and it fails, any sugestion/recommendation is welcome.

The error is:
    amazon-ebs: Installing chef
    amazon-ebs: installing with dpkg...
    amazon-ebs: Selecting previously unselected package chef.
    amazon-ebs: (Reading database ... 51167 files and directories currently installed.)
    amazon-ebs: Preparing to unpack .../chef_12.13.37-1_amd64.deb ...
    amazon-ebs: Unpacking chef (12.13.37-1) ...
    amazon-ebs: Setting up chef (12.13.37-1) ...
    amazon-ebs: Thank you for installing Chef!
    amazon-ebs: Creating directory: /tmp/packer-chef-client
    amazon-ebs: Creating directory: /tmp/packer-chef-client/cookbooks-0
    amazon-ebs: Creating directory: /tmp/packer-chef-client/roles
    amazon-ebs: Creating directory: /tmp/packer-chef-client/data_bags
    amazon-ebs: Creating configuration file 'solo.rb'
    amazon-ebs: Creating JSON attribute file
    amazon-ebs: Executing Chef: sudo chef-solo --no-color -c /tmp/packer-chef-client/solo.rb -j /tmp/packer-chef-client/node.json
    amazon-ebs: [2016-09-09T02:03:01+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /tmp/packer-chef-client
    amazon-ebs: One version per cookbook
    amazon-ebs:
    amazon-ebs: [2016-09-09T02:03:01+00:00] INFO: Forking chef instance to converge...
    amazon-ebs: [2016-09-09T02:03:01+00:00] INFO: *** Chef 12.13.37 ***
    amazon-ebs: [2016-09-09T02:03:01+00:00] INFO: Platform: x86_64-linux
    amazon-ebs: [2016-09-09T02:03:01+00:00] INFO: Chef-client pid: 1545
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/auto-lms
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Setting the run_list to ["role[chaos-lms]"] from CLI options
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Run List is [role[chaos-lms]]
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Run List expands to []
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Starting Chef Run for auto-lms
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Running start handlers
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Start handlers complete.
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Loading cookbooks []
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Chef Run complete in 0.167391007 seconds
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Running report handlers
    amazon-ebs: [2016-09-09T02:03:02+00:00] INFO: Report handlers complete

And the packer file is:

{
  "builders": [
    {
      "type": "amazon-ebs",
      "ami_name": "{{user `partner-env`}}-lms-{{user `release`}}-{{ timestamp }}",
      "source_ami": "ami-2d39803a",
      "ami_description": "Canvas web for {{user `partner-env`}}",
      "ami_groups": "all",
      "region": "us-east-1",
      "associate_public_ip_address": "true",
      "iam_instance_profile":"CloudWatch",
      "subnet_id": "{{user `aws_subnet_id`}}",
      "security_group_id": "{{user `aws_sg`}}",
      "ssh_username": "ubuntu",
      "ssh_keypair_name": "hotchalk-chef",
      "ssh_private_key_file": "/home/mleon/.ssh/hotchalk-chef.pem",
      "ssh_private_ip": "true",
      "vpc_id": "{{user `aws_vpc`}}",
      "instance_type": "t2.micro",
      "ami_block_device_mappings": [
        {
          "device_name": "/dev/sda",
          "volume_size": "10",
          "delete_on_termination": "true",
          "volume_type": "gp2"
        }
      ]
    }
  ],

  "provisioners": [
    {
      "type": "shell",
      "script": "scripts/fix_hosts.sh",
      "execute_command": "echo 'ubuntu' | sudo -S sh '{{ .Path }}'"
    },
    {
      "type": "chef-solo",
      "cookbook_paths": "cookbooks",
      "data_bags_path": "data_bags",
      "roles_path": "roles",
      "run_list": "role[{{user `chef_role`}}]"
   }
  ]
}


Thank you

John Mickey

unread,
Sep 29, 2016, 1:44:17 PM9/29/16
to Packer
I am seeing the same issue.  Did you get it fixed?

John Mickey

unread,
Sep 29, 2016, 2:48:56 PM9/29/16
to Packer
I was able to get this fixed by adding --legacy-mode to the chef options
Reply all
Reply to author
Forward
0 new messages