Giter VIP home page Giter VIP logo

Comments (10)

bastelfreak avatar bastelfreak commented on August 22, 2024

@logicminds do you have any ideas here?

from ra10ke.

bastelfreak avatar bastelfreak commented on August 22, 2024

The issue comes from:
https://github.com/puppetlabs/forge-ruby/blob/51b76eb7eed48be63ca8f03ba717b8527bee8260/lib/puppet_forge/v3/base.rb#L69

from ra10ke.

logicminds avatar logicminds commented on August 22, 2024

I'll take a look when I get a chance.

from ra10ke.

bastelfreak avatar bastelfreak commented on August 22, 2024

ahhhhhhh software.. so the Puppetfile starts with # used in profiles

deprecated = forge_modules(puppetfile).map do |mod|
# For Ruby 2.4 support
begin # rubocop:disable Style/RedundantBegin
module_name = "#{mod[:namespace] || mod[:name]}-#{mod[:name]}"
forge_data = PuppetForge::Module.find(module_name)
next forge_data if forge_data.deprecated_at
nil
rescue Faraday::ResourceNotFound
nil
end
end

forge_modules(puppetfile) seems to return an iterable and the following first hash:

{:namespace=>nil, :name=>nil, :args=>{}}

Since that's total crap, module_name contains only - and the forge URI is v3/modules/- which leads to the HTTP 400 error

from ra10ke.

bastelfreak avatar bastelfreak commented on August 22, 2024

and I'm quite sure comments are valid in a Puppetfile, so the parser is broken

from ra10ke.

logicminds avatar logicminds commented on August 22, 2024

AFAIK, comments are just ignored. So should not be an issue.
https://github.com/voxpupuli/ra10ke/blob/master/lib/ra10ke/puppetfile_parser.rb#L33

from ra10ke.

bastelfreak avatar bastelfreak commented on August 22, 2024

I'm not sure if that's the correct line. I think

all_lines = File.read(puppetfile).lines.map(&:strip_comment)
should match.
def strip_comment(markers = ['#', "\n"])
re = Regexp.union(markers)
index = (self =~ re)
index.nil? ? rstrip : self[0, index].rstrip
end

(but looks like it doesn't)

from ra10ke.

logicminds avatar logicminds commented on August 22, 2024

https://github.com/voxpupuli/ra10ke/pull/new/deprecation-issue

There is a test on this branch for reproduction.

bundle exec rspec spec/ra10ke/deprecation_spec.rb:43

from ra10ke.

bastelfreak avatar bastelfreak commented on August 22, 2024

mhm doing it by hand works also 🤔

irb(main):004:0> file = File.read('Puppetfile')
=> "# used in profiles\nmod 'puppet/systemd', :latest\nmod 'puppet/lldpd', :latest\nmod 'puppet/ferm', :latest\nmod 'puppet/borg', :latest\nmod 'puppet/wireguard', :latest\nmod 'puppet/bird', :latest\nmod 'he...
irb(main):005:0> file.lines.reject { |line| line.match(/#.*\n/) }.join("\n")
=> "mod 'puppet/systemd', :latest\n\nmod 'puppet/lldpd', :latest\n\nmod 'puppet/ferm', :latest\n\nmod 'puppet/borg', :latest\n\nmod 'puppet/wireguard', :latest\n\nmod 'puppet/bird', :latest\n\nmod 'herculesteam/augeasproviders_pam', :latest\n\nmod 'herculesteam/augeasproviders_shellvar', :latest\n\nmod 'puppetlabs/vcsrepo', :latest\n\nmod 'saz/ssh', :latest\n\nmod 'puppet/r10k', :latest\n\nmod 'puppet/dbbackup', :latest\n\nmod 'puppet/mosquitto', :latest\n\nmod 'puppet/grafana', :latest\n\nmod 'puppet/nginx', :latest\n\nmod 'puppet/ssh_keygen', :latest\n\nmod 'puppet/unbound', :latest\n\nmod 'puppetlabs/inifile', :latest\n\nmod 'puppet/prometheus', :latest\n\nmod 'theforeman/foreman', :latest\n\nmod 'theforeman/puppet', :latest\n\nmod 'theforeman/foreman_proxy', :latest\n\nmod 'puppet/nftables', :latest\n\nmod 'herculesteam/augeasproviders_sysctl', :latest\n\nmod 'camptocamp/catalog_diff', :latest\n\nmod 'puppet/unattended_upgrades', :latest\n\nmod 'puppet/selinux', :latest\n\nmod 'choria/choria', :latest\n\nmod 'puppet/archive', :latest\n\nmod 'puppet/elasticsearch', :latest\n\nmod 'jsok/vault',\n\n  git: 'https://github.com/bastelfreak/puppet-vault',\n\n  ref: 'test'\n\n\n\nmod 'herculesteam/augeasproviders_core', :latest\n\nmod 'puppetlabs/stdlib', :latest\n\nmod 'choria/mcollective', :latest\n\nmod 'puppetlabs/concat', :latest\n\nmod 'puppetlabs/apt', :latest\n\nmod 'puppetlabs/apache', :latest\n\nmod 'puppetlabs/postgresql', :latest\n\nmod 'puppet/extlib', :latest\n\nmod 'puppet/redis', :latest\n\nmod 'puppet/epel', :latest\n\nmod 'theforeman/puppetserver_foreman', :latest\n\nmod 'richardc/datacat', :latest\n\nmod 'theforeman/dns', :latest\n\nmod 'theforeman/dhcp', :latest\n\nmod 'theforeman/tftp', :latest\n\nmod 'puppetlabs/xinetd', :latest\n\nmod 'choria-mcollective_choria', :latest\n\nmod 'choria/mcollective_agent_puppet', :latest\n\nmod 'choria/mcollective_agent_package', :latest\n\nmod 'choria/mcollective_agent_service', :latest\n\nmod 'choria/mcollective_agent_filemgr', :latest\n\nmod 'choria/mcollective_agent_shell', :latest\n\nmod 'choria/mcollective_agent_nettest', :latest\n\nmod 'choria/mcollective_agent_puppetca', :latest\n\nmod 'choria/mcollective_agent_bolt_tasks', :latest\n\nmod 'choria/mcollective_agent_iptables', :latest\n\nmod 'choria/mcollective_agent_process', :latest\n\nmod 'choria/mcollective_util_actionpolicy', :latest\n\nmod 'optiz0r/mcollective_agent_puppet_env', :latest\n\nmod 'jay7x/mcollective_agent_query', :latest\n\nmod 'choria/mcollective_data_sysctl', :latest\n\nmod 'puppet/yum', :latest\n\nmod 'puppetlabs/java', :latest\n\nmod 'puppet/elastic_stack', :latest\n\nmod 'puppet/hashi_stack', :latest\n\n\n\nmod 'puppetlabs-sshkeys_core', :latest\n\nmod 'puppetlabs-mount_core', :latest\n\nmod 'puppetlabs-augeas_core', :latest\n\nmod 'puppetlabs-selinux_core', :latest\n\nmod 'puppetlabs-yumrepo_core', :latest\n"
irb(main):006:0>

from ra10ke.

logicminds avatar logicminds commented on August 22, 2024

Ok, so line 31 causes empty quotes which is not removed in the parser

all_lines = File.read(puppetfile).lines.map(&:strip_comment) This line leaves empty quotes when it should not.

from ra10ke.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.