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

Support workers tentacle types #159

Open
NootN00t opened this issue Jan 3, 2020 · 2 comments
Open

Support workers tentacle types #159

NootN00t opened this issue Jan 3, 2020 · 2 comments

Comments

@NootN00t
Copy link
Contributor

NootN00t commented Jan 3, 2020

It would be great if a tentacle could be installed and registered as a worker with Octo server.

@NootN00t
Copy link
Contributor Author

NootN00t commented Jan 3, 2020

Have been working on my own implementation which results in something like this in tentacle.rb:

action :register_worker do
  service_name = service_name(new_resource.instance)

  verify_server(new_resource.server)
  verify_api_key(new_resource.api_key)
  verify_workerpool(new_resource.workerpool)

  powershell_script "register-#{new_resource.instance}-worker" do
    action :run
    cwd tentacle_install_location
    code <<-EOH
      .\\Tentacle.exe register-worker `
        --name "#{new_resource.tentacle_name}" `
        --server "#{new_resource.server}" `
        --apiKey "#{new_resource.api_key}" `
        #{option('workerpool', new_resource.workerpool)} `
        #{option_flag('force', new_resource.forced_registration)} `
        --console
      #{catch_powershell_error('Registering Worker')}
    EOH
    not_if { tentacle_exists?(new_resource.server, new_resource.api_key, tentacle_thumbprint(new_resource.config_path), 'workers') }
    notifies :restart, "windows_service[#{service_name}]", :delayed
  end

  windows_service service_name do
    action :nothing
  end
end

Thought it would make more sense to have a separate set of actions defined in case you wanted a worker and then wanted to remove at a later date but keep the underlying tentacle install.

Did consider a whole new resource type but thought given that they are so related it made sense to append to the existing code.

Happy to PR with all the changes once the build is back up and running and get some feedback

@geoff-carr-bzy
Copy link

Is there any chance of getting this functionality included in the cookbook please? We are still relying on a internal edited copy of this repository to enable us to register workers using the code above. This has just tripped us up due to a change to the order of the create instance and certificate, so it would be good to remove the dependency on the internal repository if possible.

# 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