Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[TRACKER]Chef Workstation 2020 Testing - Knife EC2 #1176

Closed
dheerajd-msys opened this issue May 13, 2020 · 12 comments
Closed

[TRACKER]Chef Workstation 2020 Testing - Knife EC2 #1176

dheerajd-msys opened this issue May 13, 2020 · 12 comments
Assignees
Labels

Comments

@dheerajd-msys
Copy link

dheerajd-msys commented May 13, 2020

Description

Parent task

#1167

Chef Workstation Version

chef-cli -v
Chef Workstation version: 20.5.27
Chef Infra Client version: 16.0.287
Chef InSpec version: 4.18.111
Chef CLI version: 2.0.10
Test Kitchen version: 2.5.0
Cookstyle version: 6.3.4

Platform Version

cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Aha! Link: https://chef.aha.io/features/SH-1860

@dheerajd-msys dheerajd-msys added the Status: Untriaged An issue that has yet to be triaged. label May 13, 2020
@dheerajd-msys
Copy link
Author

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$ knife ec2 ami list -o self -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
AMI ID                 Platform  Architecture  Size  Name                                       Description
ami-04027a77029c6a356  windows   x86_64        30    jsnow_eng_windows_2016_full_1573155874                

@dheerajd-msys
Copy link
Author

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$ knife ec2 flavor list -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
ERROR: knife ec2 flavor list has been deprecated as this functionality is not provided by the AWS API the previous implementatin relied upon hardcoded values that were often incorrect. For an up to date list of instance types see https://www.ec2instances.info/

@dheerajd-msys
Copy link
Author

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$ knife ec2 securitygroup list -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
ID                    Name                                                                VPC ID               
sg-0019131a644807a58  default                                                             vpc-08d238023dae94c99
sg-0062ff73db4f854e5  launch-wizard-30                                                    vpc-6d9d7505         
sg-009d35b55162ad8f3  launch-wizard-6                                                     vpc-6d9d7505         

@dheerajd-msys
Copy link
Author

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$ knife ec2 server delete i-08b93638ffe476ab9 -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
Instance ID: i-08b93638ffe476ab9
Instance Name: ddubey-ubu18-msys
Flavor: t2.micro
Image: ami-54546546
Region: us-east-2
Availability Zone: us-east-2b
Security Groups: launch-wizard-30
SSH Key: my-key
Root Device Type: ebs
Public DNS Name: xxxxxxxxxx
Public IP Address: xxxxx
Private DNS Name: ixxxx
Private IP Address: xxxxxx

Do you really want to delete this server? (Y/N) Y
WARNING: Deleted server i-08b93638ffe476ab9
WARNING: Corresponding node and client for the i-08b93638ffe476ab9 server were not deleted and remain registered with the Chef Server

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$

@dheerajd-msys
Copy link
Author

dheerajdubey@PUN-LAP-DHEERAJ:~/.aws$ knife ec2 server create -I ami-xxxxxxx -U ec2-user -i ~/Downloads/ddubey-msys-chef.pem -N ddubey-amazon-msys --sudo --use-sudo-password -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb


WARN: Deprecation CHEF-29 from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/knife-ec2-1.0.36/lib/chef/knife/helpers/ec2_base.rb:183:in `locate_config_value'

  Use of config_value without a fallback_key is deprecated.  Knife plugin authors should access the config hash directly, which does correct merging of cli and config options.

Please see https://docs.chef.io/deprecations_knife_bootstrap_apis/ for further details and information on how to correct this problem.
WARN: Deprecation CHEF-29 from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/knife-ec2-1.0.36/lib/chef/knife/helpers/ec2_base.rb:183:in `locate_config_value'

  Use of config_value without a fallback_key is deprecated.  Knife plugin authors should access the config hash directly, which does correct merging of cli and config options.

@dheerajd-msys dheerajd-msys self-assigned this May 13, 2020
@dheerajd-msys
Copy link
Author

dheerajd-msys commented May 31, 2020

On master branch with latest code getting this error : ( For Region us-east-1)

bundle exec knife ec2 server create -I ami-xxxxxxx -U ubuntu -N ddubey-ubu-msys --sudo -c /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb --region us-east-1 --use-sudo-password --yes -VV
INFO: Using configuration from /home/dheerajdubey/Downloads/chef-repo/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 16
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at /etc/chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at /etc/chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region us-east-1
DEBUG: Setting up AWS connection using aws_access_key_id: ASIAXXXXXXXXXXXXXXXX aws_secret_access_key: HTc+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token: FwoGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Generated keypair file: /home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem

Waiting for EC2 to create the instance
Instance ID: i-050d5b895da2df946
Flavor: m1.small
Image: ami-xxxxxxxxx
Region: us-east-1
Availability Zone: us-east-1a
AWS Tags: Name: ddubey-ubu-msys
SSH Key: ubuntu-cbcf83cd1aff1bc53740
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-xxxxxxx.compute-1.amazonaws.com
Public IP Address: xxxxxxx
Private DNS Name: ip-172-31-11-103.ec2.internal
Private IP Address: 172.31.11.103

Waiting for sshd access to become available
SSH Target Address: ec2-xxxxxxx.compute-1.amazonaws.com(public_dns_name)
DEBUG: No ssh gateway found, making a direct connection
DEBUG: sshd accepting connections on ec2-xxxxx.compute-1.amazonaws.com, banner is SSH-2.0-OpenSSH_8.2p1 Ubuntu-4

done

SSH Target Address: ec2-xxxxx.compute-1.amazonaws.com(public_dns_name)
Connecting to ec2-xxxxx.compute-1.amazonaws.com
DEBUG: [SSH] opening connection to [email protected]
DEBUG: [SSH] using options {:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "publickey"], :keys_only=>true, :keys=>["/home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem"], :password=>"<hidden>", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:always}
Connecting to ec2-xxxxxx.compute-1.amazonaws.com
DEBUG: [SSH] opening connection to [email protected]
DEBUG: [SSH] using options {:user_known_hosts_file=>"/dev/null", :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>60, :auth_methods=>["none", "publickey"], :keys_only=>true, :keys=>["/home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-cbcf83cd1aff1bc53740.pem"], :password=>"<hidden>", :forward_agent=>nil, :non_interactive=>true, :verify_host_key=>:accept_new}
DEBUG: [SSH] [email protected] cmd = cmd.exe /c ver
DEBUG: [SSH] [email protected] cmd = Get-WmiObject Win32_OperatingSystem | Select Caption,Version | ConvertTo-Json
DEBUG: [SSH] [email protected] cmd = uname -s
DEBUG: [SSH] [email protected] cmd = uname -m
DEBUG: [SSH] [email protected] cmd = test -f /etc/debian_version
DEBUG: [SSH] [email protected] cmd = test -f /etc/lsb-release && cat /etc/lsb-release
DEBUG: [SSH] [email protected] cmd = sh -c '(sudo echo) < /dev/null'
DEBUG: [SSH] [email protected] cmd = sudo echo '[SSH] Established'
**bundler: failed to load command: knife (/home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife)**
**Net::HTTPServerException: 401 "Unauthorized**"
  /opt/chef-workstation/embedded/lib/ruby/2.7.0/net/http/response.rb:124:in `error!'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/http.rb:152:in `request'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/http.rb:115:in `get'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:191:in `resource_exists?'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:176:in `sanity_check'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap/client_builder.rb:55:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap.rb:578:in `register_client'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife/bootstrap.rb:557:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:490:in `block in run_with_pretty_exceptions'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/local_mode.rb:42:in `with_server_connectivity'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:489:in `run_with_pretty_exceptions'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/knife.rb:229:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/lib/chef/application/knife.rb:163:in `run'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/chef-16.1.16/bin/knife:24:in `<top (required)>'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife:23:in `load'
  /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/bin/knife:23:in `<top (required)>'
dheerajdubey@PUN-LAP-DHEERAJ:~/Chef_Repo/knife-ec2$

@dheerajd-msys
Copy link
Author

On Region us-east-2 ec2 server create is busted with :

Generated keypair file: /home/dheerajdubey/Downloads/chef-repo/.chef/ubuntu-22e73b816f6c524ceb85.pem
**ERROR: The requested configuration is currently not supported. Please check the documentation for supported configurations.**
DEBUG: /home/dheerajdubey/Chef_Repo/knife-ec2/vendor/cache/ruby/2.7.0/gems/aws-sdk-core-3.96.1/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'

@dheerajd-msys
Copy link
Author

@lamont-granquist ^^

@lamont-granquist
Copy link
Contributor

Is there any different behavior though on chef 15.9.x and knife-ec2 1.0.36?

@dheerajd-msys
Copy link
Author

Hi @lamont-granquist, Yes I checked with chef 15.9.17 and knife-ec2 1.0.36 ec2 server create command is getting completed successfully on us-east-1, while on us-east-2 configuration not supported error is still there like #1176 (comment).

[ec2-xxxx.compute-1.amazonaws.com] Chef Infra Client finished, 0/0 resources updated in 03 seconds
 [ec2-xxxx.compute-1.amazonaws.com] 

Instance ID: i-xxxxxxxxxxxxx
Flavor: m1.small
Image: ami-xxxxxxxxxxxx
Region: us-east-1
Availability Zone: us-east-1a
Security Group Ids: sg-166d9563
AWS Tags: Name: ddubey-ubu-msys
SSH Key: ubuntu-589ad43bb11d2d9b06ba
Root Device Type: ebs
Root Device Name: /dev/sda1
Root Volume ID: vol-0551a38c91ff459fe
Root Device Delete on Terminate: true

Block devices
===========================
Device Name: /dev/sda1
Volume ID: vol-0551a38c91ff459fe
Delete on Terminate: true

===========================
Public DNS Name: ec2-xxxxxx.compute-1.amazonaws.com
Public IP Address: xxxxxxx
Private DNS Name: ip-xxxxxx.ec2.internal
Private IP Address: xxxxxx
Environment: _default
JSON Attributes: {:run_list=>[]}
dheerajdubey@PUN-LAP-DHEERAJ:~/Chef_Repo/chef$ gem list knife-ec2*

*** LOCAL GEMS ***

knife-ec2 (1.0.36)
dheerajdubey@PUN-LAP-DHEERAJ:~/Chef_Repo/chef$ chef-client -v
Chef Infra Client: 15.9.17
dheerajdubey@PUN-LAP-DHEERAJ:~/Chef_Repo/chef$

@lamont-granquist
Copy link
Contributor

Okay sounds like that's just a bug that needs to get reported against knife-ec2 then and not really a regression against chef-16

@dheerajd-msys
Copy link
Author

Thanks @lamont-granquist knife-ec2 issue chef/knife-ec2#650 is created against #1176 (comment)

Closing this now

@jonsmorrow jonsmorrow added Epic and removed Status: Untriaged An issue that has yet to be triaged. labels Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants