Closed bastelfreak closed 2 years ago
@logicminds do you have any ideas here?
I'll take a look when I get a chance.
ahhhhhhh software.. so the Puppetfile starts with # used in profiles
https://github.com/voxpupuli/ra10ke/blob/07fbd735ba156676f3af5b2b15354876aa2989a6/lib/ra10ke/deprecation.rb#L43-L55
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
and I'm quite sure comments are valid in a Puppetfile, so the parser is broken
AFAIK, comments are just ignored. So should not be an issue. https://github.com/voxpupuli/ra10ke/blob/master/lib/ra10ke/puppetfile_parser.rb#L33
I'm not sure if that's the correct line. I think https://github.com/voxpupuli/ra10ke/blob/07fbd735ba156676f3af5b2b15354876aa2989a6/lib/ra10ke/puppetfile_parser.rb#L31 should match. https://github.com/voxpupuli/ra10ke/blob/07fbd735ba156676f3af5b2b15354876aa2989a6/lib/ra10ke/monkey_patches.rb#L23-L27
(but looks like it doesn't)
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
mhm doing it by hand works also :thinking:
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>
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.
running the r10k:deprecation rake task I get:
This is from the master branch. I get the same error with the last release. The used Puppetfile: