Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make our type camptocamp/archive compatible #176

Merged
merged 3 commits into from
Jul 13, 2016
Merged

make our type camptocamp/archive compatible #176

merged 3 commits into from
Jul 13, 2016

Conversation

igalic
Copy link
Contributor

@igalic igalic commented Jun 21, 2016

our type now accepts the same parameters as camptocamp/archive and processes them correctly.

(this parameter is for camptocamp/archive compatibility).'
newvalues(/\b[0-9a-f]{5,128}\b/)
munge do |val|
resource[:checksum] = val
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this munge needs to be handled differently

@daenney
Copy link
Member

daenney commented Jun 21, 2016

So what's the purpose of achieving compatibility? I thought the idea was to merge the modules?

@igalic
Copy link
Contributor Author

igalic commented Jun 21, 2016

currently, it's impossible to drop-in-replace either of the modules with the other
This patch serves as an attempt to get them a little bit closer.

@igalic igalic changed the title first stab at camptocamp/archive compatibility make archive type camptocamp/archive compatible Jun 21, 2016
@igalic igalic changed the title make archive type camptocamp/archive compatible make our type camptocamp/archive compatible Jun 21, 2016
@igalic
Copy link
Contributor Author

igalic commented Jun 21, 2016

i've now spec tested the first module against my branch…
@lesaux's puppet-kibana4

diff --git a/.fixtures.yml b/.fixtures.yml
index ad31c79..b32fd48 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -1,7 +1,9 @@
 fixtures:
   repositories:
      stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
-     archive: "https://github.com/camptocamp/puppet-archive.git"
+     archive:
+       repo: "https://github.com/igalic/puppet-archive-1.git"
+       branch: "camptocamp-compat"
      apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
   symlinks:
     'kibana4': "#{source_dir}"

works out perfectly fine… because it has no tests for archive _

@lesaux
Copy link

lesaux commented Jun 21, 2016

I've recently deprecated installing kibana4 from the tar.gz archive, since elastic.co is now maintaining packages.

@igalic
Copy link
Contributor Author

igalic commented Jun 21, 2016

well that's one problem solved… 1209012390439034 others to go ;)

@igalic
Copy link
Contributor Author

igalic commented Jul 6, 2016

this commit now adds archive::download


n.b.: i didn't copy camptocamp's archive::download spec tests if they had any :D
relatedly: it appears that archive::download is "private"

@alexjfisher
Copy link
Member

I've been wondering whether we really want to clutter this module with compatibility types and parameters.

If we get the missing features implemented, might it be better to then start creating PRs against popular modules that use camptocamp/archive? It's even possible to make a module work with both camptocamp/archive and puppet/archive by using stdlib's load_module_metadata. That's what I've done in cpitman/puppet-database_schema#4

@igalic
Copy link
Contributor Author

igalic commented Jul 7, 2016

from Joe Duffy's blog about Midori (a research operating system)

Lets say that for any given 1 producer of state there are 10 consumers. Rather than having each of those 10 defend themselves against error conditions, we can push the responsibility back onto that 1 producer, and either require a single assertion that coerces the type, or even better, that the value is stored into the right type in the first place.

@alexjfisher what you're suggesting is "worse is better". i disagree.

@jyaworski
Copy link
Member

I agree with @igalic. We want to fix the module, not the things that use it. Take the Linux stance: 'userspace is never the problem.' I'm for adding compatibility types. We can remove them in a major release later.

@alexjfisher
Copy link
Member

Fair enough. Thought it was worth asking anyway. It might still be interesting to know how many modules are using camptocamp/archive. I wonder if I can use the forge API to tell me...

@alexjfisher
Copy link
Member

... turns out, I can ;)
These are the forge modules that list camptocamp/archive as a dependency in their latest release.
Ordered by total downloads across all releases.

[{:module=>"rtyler-jenkins", :downloads=>253718},
 {:module=>"bfraser-grafana", :downloads=>47516},
 {:module=>"camptocamp-tomcat", :downloads=>26947},
 {:module=>"tohuwabohu-duplicity", :downloads=>8957},
 {:module=>"tohuwabohu-drupal", :downloads=>6795},
 {:module=>"pennycoders-marathon", :downloads=>6392},
 {:module=>"jschilperoord-papertrail", :downloads=>6324},
 {:module=>"pennycoders-zookeeper", :downloads=>6078},
 {:module=>"pennycoders-mesos", :downloads=>5148},
 {:module=>"nrvale0-google_cloud_sdk", :downloads=>4108},
 {:module=>"cpitman-database_schema", :downloads=>4020},
 {:module=>"tohuwabohu-roundcube", :downloads=>3956},
 {:module=>"tohuwabohu-confluence", :downloads=>3790},
 {:module=>"flypenguin-teamcity", :downloads=>3137},
 {:module=>"benforge-activemq", :downloads=>2021},
 {:module=>"benforge-jbosseap", :downloads=>1740},
 {:module=>"GobuNatarajan-gsutil", :downloads=>1510},
 {:module=>"puppetlabs-rkt", :downloads=>1423},
 {:module=>"RanjithKumar45-gcloudsdk", :downloads=>0}]

@igalic
Copy link
Contributor Author

igalic commented Jul 7, 2016

nice! thank you for the stats!

@igalic
Copy link
Contributor Author

igalic commented Jul 8, 2016

okay, so, in my archive::download patch i made some adjustments to fix up incompatibilities… which makes me wonder what i can do to archive itself to discover usage of camptocamp style sematics vs voxpupuli style.

i'm also contemplating to copy camptocamp's spec tests to see how compatible we are — but not sure how that'll actually work, since they are written for a defined type, and ours is a type/provider

our type now accepts the same parameters as camptocamp/archive and
processes them correctly.
since camptocamp/archive is apache-2.0 licensed, we can simply copy it!
the body is filled with a call archive.
@igalic
Copy link
Contributor Author

igalic commented Jul 8, 2016

someone tried using this patchset as replacement for camptocamp/archive and reported the following error:

Error: Failed to apply catalog: Parameter checksum failed on Archive[/var/lib/jenkins/plugins/workflow-scm-step.hpi]: Invalid value "". Valid values are true, false. Valid values match /\b[0-9a-f]{5,128}\b/. at /etc/puppetlabs/code/environments/dev/modules/archive/manifests/download.pp:54

@igalic
Copy link
Contributor Author

igalic commented Jul 8, 2016

tests green except for that blacksmith/rest-client issue, for which we have a pr lined up here voxpupuli/puppet-blacksmith#35

that default should be false — for maximum compatibility with both modules
newparam(:cookie) do
desc 'archive file download cookie.'
end

newparam(:checksum) do
desc 'archive file checksum (match checksum_type).'
newvalues(%r{\b[0-9a-f]{5,128}\b}, :true, :false, :undef, nil, '')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it works with the latest _release_ or rtyler/jenkins

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(a.k.a.: we're running it in prod now ;)

@raphink
Copy link
Member

raphink commented Jul 12, 2016

Camptocamp compatible

@@ -0,0 +1,64 @@
# == Definition: archive::download
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igalic Maybe document this type as for compatibility with camptocamp? You would otherwise always use the native archive type directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wasn't documented in camptocamp/archive either _
i don't want to document it, because it's just a shim. private api that moves as camptocamp/archive moves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I wasn't clear (story of my life!) I don't mean document all the parameters etc. I mean just add a line to say that it is a shim/private etc. Something to discourage new users from thinking this is the way they should be using the module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to how the new parameters in the type are marked (this parameter is for camptocamp/archive compatibility)

@alexjfisher
Copy link
Member

Other than a updating the README and comments in archive::download LGTM. 👍

@nibalizer nibalizer merged commit a5f344e into voxpupuli:master Jul 13, 2016
@igalic igalic deleted the camptocamp-compat branch July 13, 2016 18:21
cegeka-jenkins pushed a commit to cegeka/puppet-archive that referenced this pull request Mar 26, 2021
make our type camptocamp/archive compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants