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

Runtime Error when domain join #45

Open
akdasari opened this issue May 31, 2020 · 1 comment
Open

Runtime Error when domain join #45

akdasari opened this issue May 31, 2020 · 1 comment

Comments

@akdasari
Copy link

akdasari commented May 31, 2020

Hi
I have chef client version:

ChefDK version: 4.7.73
Chef Infra Client version: 15.7.32
Chef InSpec version: 4.18.51

using this cookbook i'm trying my code as follows

domain_join 'mydomain' do
  action :join
  domain           'myorg.onmicrosoft.com'
  domain_user      node['cookbook']['domain_user']
  domain_password  node['cookbook']['domain_password'] 
  ou               nil
end

getting following error while Kitchen Converge

 Running handlers complete
       [2020-05-31T16:40:27+00:00] ERROR: Exception handlers complete
       Chef Infra Client failed. 0 resources updated in 05 seconds
       [2020-05-31T16:40:27+00:00] FATAL: Stacktrace dumped to C:/Users/azure/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
       [2020-05-31T16:40:27+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2020-05-31T16:40:27+00:00] DEBUG: RuntimeError: domain_join[myorg.onmicrosoft.com] (my-test::test_join line 2) had an error: RuntimeError:
       C:/Users/azure/AppData/Local/Temp/kitchen/cache/cookbooks/ad-join/resources/domain_join_windows.rb:34:in `block in class_from_file'
       (eval):2:in `block in action_join'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/provider.rb:279:in `instance_eval'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/provider.rb:279:in `compile_and_converge_action'
       (eval):2:in `action_join'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/provider.rb:220:in `run_action'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource.rb:591:in `run_action'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:74:in `run_action'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:108:in `block in run_all_actions'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:108:in `each'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:108:in `run_all_actions'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:132:in `block in converge'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/resource_list.rb:96:in `block in execute_each_resource'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:115:in `call_iterator_block'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:86:in `step'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in `execute_each_resource'
       C:/opscode/chef/embedded/lib/ruby/2.7.0/forwardable.rb:235:in `execute_each_resource'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/runner.rb:130:in `converge'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/client.rb:714:in `block in converge'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/client.rb:709:in `catch'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/client.rb:709:in `converge'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/client.rb:733:in `converge_and_save'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/client.rb:288:in `run'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/application.rb:292:in `run_with_graceful_exit_option'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/application.rb:268:in `block in run_chef_client'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/application.rb:251:in `run_chef_client'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/application/base.rb:335:in `run_application'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-16.1.16-universal-mingw32/lib/chef/application.rb:68:in `run'
       C:/opscode/chef/embedded/lib/ruby/gems/2.7.0/gems/chef-bin-16.1.16/bin/chef-client:25:in `<top (required)>'
       C:/opscode/chef/bin/chef-client:184:in `load'
       C:/opscode/chef/bin/chef-client:184:in `<main>'
       [2020-05-31T16:40:27+00:00] FATAL: RuntimeError: domain_join[casdevops.onmicrosoft.com] (gsr-test::test_join line 2) had an error: RuntimeError:
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed

No clue what's going wrong, can somebody give me proper direction?

@spuder
Copy link
Contributor

spuder commented Jun 1, 2020

Looks like you are hitting line 34 in domain_join_windows

https://github.com/NetDocuments/ad-join-cookbook/blob/master/resources/domain_join_windows.rb

Most likely you have a hostname that is longer than 15 characters long.
This is a safety check in the cookbook since most domains have netbios enabled which limits hostnames to 15 characters.

https://www.itprotoday.com/compute-engines/jsi-tip-2721-netbios-names-are-exactly-16-characters-length

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

No branches or pull requests

2 participants