https://www.puppet.com/community logo
Join Slack
Powered by
# voxpupuli
  • v

    VoxBot

    03/27/2023, 1:15 PM
    looks like it's an opinionated config on top of RuboCop
  • v

    VoxBot

    03/27/2023, 1:16 PM
    Because StandardRB is essentially a wrapper on top of RuboCop
  • v

    VoxBot

    03/27/2023, 1:16 PM
    ah
  • y

    Yury Bushmelev

    03/27/2023, 1:27 PM
    Copy code
    if mount.key?('opts')
                    a << mount['opts'] if mount.key?('opts')
                  else
                    a << mount['opts'] = 'z'
                  end
    Here 2nd line do not need the
    if mount.key?('opts')
    , right? It’s useless as I see
  • v

    VoxBot

    03/27/2023, 1:28 PM
    I'd write it as: mounts['opts'] ||= 'z' ; a << mounts['opts']
  • v

    VoxBot

    03/27/2023, 1:28 PM
    way clearer in what it's doing IMHO
  • v

    VoxBot

    03/27/2023, 1:29 PM
    though it may actually be slightly different: ||= also replaces nil with 'z'
  • v

    VoxBot

    03/27/2023, 1:30 PM
    so this is the exact replacement in terms of behavior: mounts['opts'] = 'z' unless mounts.key('opts') ; a << mounts['opts']
  • y

    Yury Bushmelev

    03/27/2023, 1:35 PM
    well.. tbh, I see no point to define
    mount['opts']
    as
    nil
    .. it’ll break the
    docker
    command
  • y

    Yury Bushmelev

    03/27/2023, 1:35 PM
    so
    a << mounts['opts'] ||= 'z'
    should be good enough from my point of view
  • y

    Yury Bushmelev

    03/27/2023, 1:40 PM
    though.. maybe I’ll leave it as it is for now until end of rubocop cleanup..
  • v

    VoxBot

    03/27/2023, 1:40 PM
    I wouldn't try to be smart and combine it in a single line
  • v

    VoxBot

    03/27/2023, 1:41 PM
    because || and ||= are very close, it's too easy to misread or make a mistake
  • y

    Yury Bushmelev

    03/27/2023, 1:42 PM
    I see the point 🤔 well.. I’ll leave “FIXME” comment there for now
  • y

    Yury Bushmelev

    03/27/2023, 1:43 PM
    though TODO is better
  • y

    Yury Bushmelev

    03/27/2023, 1:47 PM
    Another thing I’m not sure about is https://github.com/voxpupuli/beaker-docker/blob/master/spec/beaker/hypervisor/docker_spec.rb#L555
  • y

    Yury Bushmelev

    03/27/2023, 1:47 PM
    Another thing I’m not sure about is https://github.com/voxpupuli/beaker-docker/blob/master/spec/beaker/hypervisor/docker_spec.rb#L555
  • y

    Yury Bushmelev

    03/27/2023, 1:48 PM
    Copy code
    FakeFS do
                    File.open('/.dockerenv', 'w') {}
                    docker.provision
    rubocop complains about empty block
    {}
    .. as I understand this creates an empty file in FakeFS and closes it immediately (because block is empty)
  • y

    Yury Bushmelev

    03/27/2023, 1:49 PM
    after reading some docs about the File module I’d say it’s ok to drop the {} and add File.close() after
  • y

    Yury Bushmelev

    03/27/2023, 1:49 PM
    or maybe add the comment about this into the block (which is one line longer then)
  • v

    VoxBot

    03/27/2023, 1:56 PM
    I'd go with FileUtils.touch in this case
  • v

    VoxBot

    03/27/2023, 1:56 PM
    it just ensures the file exists
  • y

    Yury Bushmelev

    03/27/2023, 1:56 PM
    I guess this is ok:
    File.open('/.dockerenv', 'w').close
  • y

    Yury Bushmelev

    03/27/2023, 1:56 PM
    ah.. good idea, let me try
  • y

    Yury Bushmelev

    03/27/2023, 1:59 PM
    touch
    works fine (at least unit tests are good), ty!
  • r

    Robert Waffen

    03/27/2023, 2:14 PM
    may somebody pls have a look here? https://github.com/voxpupuli/beaker-hiera/pull/19 why is ruby 2.4 still required when i removed it from the code as dependency?
  • r

    Robert Waffen

    03/27/2023, 2:14 PM
    may somebody have a look here? https://github.com/voxpupuli/beaker-hiera/pull/19 why is ruby 2.4 still required when i removed it from the code as dependency?
  • r

    Robert Waffen

    03/27/2023, 2:15 PM
    may somebody pls have a look here? https://github.com/voxpupuli/beaker-hiera/pull/19 why is ruby 2.4 still required when i removed it from the code as dependency?
  • v

    VoxBot

    03/27/2023, 2:16 PM
    those are required branches in GH
  • v

    VoxBot

    03/27/2023, 2:17 PM
    the trick we use in gha-puppet is to add a last step that's a dummy step which depends on all the previous steps
1...384385386...648Latest