Class: R10K::Environment::Tarball
- Inherits:
-
WithModules
- Object
- Base
- WithModules
- R10K::Environment::Tarball
- Includes:
- Util::Purgeable, Util::Setopts
- Defined in:
- lib/r10k/environment/tarball.rb
Constant Summary
Constants included from Util::Purgeable
Util::Purgeable::FN_MATCH_OPTS, Util::Purgeable::HIDDEN_FILE
Constants included from Logging
Logging::LOG_LEVELS, Logging::SYSLOG_LEVELS_MAP
Instance Attribute Summary collapse
-
#tarball ⇒ Object
readonly
Returns the value of attribute tarball.
Attributes inherited from WithModules
Attributes inherited from Base
#basedir, #dirname, #loader, #managed_directories, #name, #puppetfile, #puppetfile_name
Instance Method Summary collapse
-
#desired_contents ⇒ Array<String>
Returns an array of the full paths to all the content being managed.
-
#initialize(name, basedir, dirname, options = {}) ⇒ Tarball
constructor
Initialize the given tarball environment.
- #path ⇒ Object
- #signature ⇒ Object
- #status ⇒ Object
- #sync ⇒ Object
Methods included from Util::Purgeable
#current_contents, #logger, #managed_directories, #matches?, #pending_contents, #potentially_purgeable, #purge!, #stale_contents
Methods included from Logging
add_outputters, debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Methods inherited from WithModules
#accept, #add_module, #cleanpath, #deploy, #load_modules, #module_conflicts?, #modules, #purge_exclusions, #resolve_path, #validate_install_path
Methods inherited from Base
#accept, #deploy, #determine_purge_exclusions, #generate_types!, #info, #load_puppetfile_modules, #module_conflicts?, #modules, #purge_exclusions, #whitelist
Constructor Details
#initialize(name, basedir, dirname, options = {}) ⇒ Tarball
Initialize the given tarball environment.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/r10k/environment/tarball.rb', line 25 def initialize(name, basedir, dirname, = {}) super setopts(, { # Standard option interface :type => ::R10K::Util::Setopts::Ignore, :source => :self, :version => :checksum, # Type-specific options :checksum => :self, }) @tarball = R10K::Tarball.new(name, @source, checksum: @checksum) end |
Instance Attribute Details
#tarball ⇒ Object (readonly)
Returns the value of attribute tarball.
12 13 14 |
# File 'lib/r10k/environment/tarball.rb', line 12 def tarball @tarball end |
Instance Method Details
#desired_contents ⇒ Array<String>
This implements a required method for the Purgeable mixin
Returns an array of the full paths to all the content being managed.
73 74 75 76 77 |
# File 'lib/r10k/environment/tarball.rb', line 73 def desired_contents desired = [] desired += @tarball.paths.map { |entry| File.join(@full_path, entry) } desired += super end |
#path ⇒ Object
40 41 42 |
# File 'lib/r10k/environment/tarball.rb', line 40 def path @path ||= Pathname.new(File.join(@basedir, @dirname)) end |
#signature ⇒ Object
64 65 66 |
# File 'lib/r10k/environment/tarball.rb', line 64 def signature @checksum || @tarball.cache_checksum end |
#status ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/r10k/environment/tarball.rb', line 54 def status if not path.exist? :absent elsif not (tarball.cache_valid? && tarball.insync?(path.to_s, ignore_untracked_files: true)) :mismatched else :insync end end |
#sync ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/r10k/environment/tarball.rb', line 44 def sync tarball.get unless tarball.cache_valid? case status when :absent, :mismatched tarball.unpack(path.to_s) # Untracked files left behind from previous extractions are expected to # be deleted by r10k's purge facility. end end |