garethr-docker icon indicating copy to clipboard operation
garethr-docker copied to clipboard

Adding support for Docker service 'After' attribute in Unit file

Open eyal-lupu opened this issue 8 years ago • 2 comments

This is a pull request for: https://github.com/garethr/garethr-docker/issues/619

eyal-lupu avatar Jan 13 '17 16:01 eyal-lupu

Hi @eyal-lupu. Thanks for your contribution! The PR is looking good, though we require a few things to move forward.

  1. There will need to be some spec tests to confirm your changes are behaving in the manner you expect.

An example is https://github.com/garethr/garethr-docker/pull/534/files#diff-57c32a956fccf5af23aba2bce1d74d1d.

  1. The commits will need to be squashed before they can be merged.

If you have any questions just let us know.

gregohardy avatar Jan 20 '17 14:01 gregohardy

Hi @garethr

thank you for your response. I an not familiar with Ruby at all but reverse engineering the existing tests it seems that adding a test similar to the below should work

context 'with systemd service_unit_after' do
        let(:params) { { 'service_unit_after' => 'network-online.target' } }
        it { should contain_file(service_override_file).with_content(/After=network-online.target/) }
        end  

It does run but seems to be failing as the override files is missing:

  1. docker on RedHat with systemd service_unit_after should contain File[/etc/systemd/system/docker.service.d/service-overrides.conf] with content =~ /After=network-online.target/ Failure/Error: it { should contain_file(service_override_file).with_content(/After=network-online.target/) } expected that the catalogue would contain File[/etc/systemd/system/docker.service.d/service-overrides.conf] # ./spec/classes/docker_spec.rb:214:in `block (5 levels) in <top (required)>'

As I am really not familiar with that environment I am a bit blocked in here. If someone could enable the tests to create the file I will be more than happy to take that from there

eyal-lupu avatar Jan 23 '17 13:01 eyal-lupu