Class: Puppet::Provider::BambooArtifactHandlerProvider
- Inherits:
-
BambooProvider
- Object
- BambooProvider
- Puppet::Provider::BambooArtifactHandlerProvider
- Defined in:
- lib/puppet/provider/bamboo_artifact_handler/bamboo_artifact_handler_provider.rb
Class Method Summary collapse
-
.instances ⇒ Object
Find server local artifact handler configuration via invoking bamboo REST api.
- .map_config_to_resource_hash(artifact_handler_config) ⇒ Object
Instance Method Summary collapse
Class Method Details
.instances ⇒ Object
Find server local artifact handler configuration via invoking bamboo REST api. Map response from json format to resource properties Invoked during ‘puppet resource`
10 11 12 13 14 15 16 17 |
# File 'lib/puppet/provider/bamboo_artifact_handler/bamboo_artifact_handler_provider.rb', line 10 def self.instances bamboo_settings = Bamboo::Rest.get_bamboo_settings(self.bamboo_resource, self.content_type) hash = map_config_to_resource_hash(bamboo_settings) # set resource name to the artifact handler type. # When applying the manifest, puppet will choose the right provider based on the resource name hash[:name] = self.artifact_handler_type [new(hash)] end |
.map_config_to_resource_hash(artifact_handler_config) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/puppet/provider/bamboo_artifact_handler/bamboo_artifact_handler_provider.rb', line 19 def self.map_config_to_resource_hash(artifact_handler_config) { :shared_artifacts_enabled => artifact_handler_config['sharedArtifactsEnabled'].to_s.intern, :non_shared_artifacts_enabled => artifact_handler_config['nonsharedArtifactsEnabled'].to_s.intern, } end |
Instance Method Details
#map_resource_hash_to_config ⇒ Object
26 27 28 29 30 31 |
# File 'lib/puppet/provider/bamboo_artifact_handler/bamboo_artifact_handler_provider.rb', line 26 def map_resource_hash_to_config config = {} config['sharedArtifactsEnabled'] = resource[:shared_artifacts_enabled].to_s unless resource[:shared_artifacts_enabled].nil? config['nonsharedArtifactsEnabled'] = resource[:non_shared_artifacts_enabled].to_s unless resource[:non_shared_artifacts_enabled].nil? config end |