Class: PuppetX::Aptly::CliHelper
- Inherits:
-
Object
- Object
- PuppetX::Aptly::CliHelper
- Defined in:
- lib/puppet_x/voxpupuli/aptly/cli_helper.rb
Class Method Summary collapse
- .aptly_command(*args) ⇒ Object
-
.mirror_create(name, url, distribution, options = {}) ⇒ Object
Mirror.
- .mirror_drop(name, options = {}) ⇒ Object
- .mirror_edit(name, options = {}) ⇒ Object
- .mirror_list(options = {}) ⇒ Object
- .mirror_show(name, options = {}) ⇒ Object
- .mirror_update(name, options = {}) ⇒ Object
- .publish_drop(distribution, prefix, options = {}) ⇒ Object
- .publish_list(options = {}) ⇒ Object
- .publish_repo(names, prefix, options = {}) ⇒ Object
- .publish_show(distribution, prefix, options = {}) ⇒ Object
-
.publish_snapshot(names, prefix, options = {}) ⇒ Object
Publish.
- .publish_switch(distribution, prefix, snapshots, options = {}) ⇒ Object
- .publish_update(distribution, prefix, options = {}) ⇒ Object
- .repo_add(name, package_or_directory, options = {}) ⇒ Object
-
.repo_create(name, options = {}) ⇒ Object
Repo.
- .repo_drop(name, options = {}) ⇒ Object
- .repo_list(options = {}) ⇒ Object
- .repo_remove(name, package_query, options = {}) ⇒ Object
- .repo_show(name, options = {}) ⇒ Object
-
.snapshot_create(name, from, options = {}) ⇒ Object
Snapshot.
- .snapshot_drop(name, options = {}) ⇒ Object
- .snapshot_list(options = {}) ⇒ Object
- .snapshot_show(name, options = {}) ⇒ Object
Class Method Details
.aptly_command(*args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 14 def self.aptly_command(*args) opts = args.shift cmd = opts[:aptly_command] || 'aptly' env = opts[:aptly_environment] || {} result = [] result << env if env.any? result << cmd result + args end |
.mirror_create(name, url, distribution, options = {}) ⇒ Object
Mirror
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 26 def self.mirror_create(name, url, distribution, = {}) cmd = aptly_command(, 'mirror', 'create') cmd += () cmd << "-filter=#{[:filter]}" if [:filter] cmd << '-filter-with-deps' if [:filter_with_deps] cmd << '-force-architectures' if [:force_architectures] cmd << '-force-components' if [:force_components] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << "-max-tries=#{[:max_tries]}" if [:max_tries] cmd << '-with-installer' if [:with_installer] cmd << '-with-sources' if [:with_sources] cmd << '-with-udebs' if [:with_udebs] cmd += [name, url, distribution] cmd += Array([:component]) execute(cmd) end |
.mirror_drop(name, options = {}) ⇒ Object
67 68 69 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 67 def self.mirror_drop(name, = {}) something_drop('mirror', name, ) end |
.mirror_edit(name, options = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 71 def self.mirror_edit(name, = {}) cmd = aptly_command(, 'mirror', 'edit') cmd += () cmd << "-archive-url=#{[:archive_url]}" if [:archive_url] cmd << "-filter=#{[:filter]}" if [:filter] cmd << '-filter-with-deps' if [:filter_with_deps] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << '-with-installer' if [:with_installer] cmd << '-with-sources' if [:with_sources] cmd << '-with-udebs' if [:with_udebs] cmd << name execute(cmd) end |
.mirror_list(options = {}) ⇒ Object
59 60 61 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 59 def self.mirror_list( = {}) something_list('mirror', ) end |
.mirror_show(name, options = {}) ⇒ Object
63 64 65 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 63 def self.mirror_show(name, = {}) something_show('mirror', name, ) end |
.mirror_update(name, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 44 def self.mirror_update(name, = {}) cmd = aptly_command(, 'mirror', 'update') cmd += () cmd << "-download-limit=#{[:download_limit]}" if [:download_limit] cmd << "-downloader=#{[:downloader]}" if [:downloader] cmd << '-force' if [:force] cmd << '-ignore-checksums' if [:ignore_checksums] cmd << '-ignore-signatures' if [:ignore_signatures] cmd += Array([:keyring]).map { |x| "-keyring=#{x}" } cmd << "-max-tries=#{[:max_tries]}" if [:max_tries] cmd << '-skip-existing-packages' if [:skip_existing_packages] cmd << name execute(cmd) end |
.publish_drop(distribution, prefix, options = {}) ⇒ Object
198 199 200 201 202 203 204 205 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 198 def self.publish_drop(distribution, prefix, = {}) cmd = aptly_command(, 'publish', 'drop') cmd += () cmd << '-force-drop' if [:force_drop] cmd << '-skip-cleanup' if [:skip_cleanup] cmd << distribution << prefix execute(cmd) end |
.publish_list(options = {}) ⇒ Object
187 188 189 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 187 def self.publish_list( = {}) something_list('publish', ) end |
.publish_repo(names, prefix, options = {}) ⇒ Object
175 176 177 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 175 def self.publish_repo(names, prefix, = {}) publish_something('repo', names, prefix, ) end |
.publish_show(distribution, prefix, options = {}) ⇒ Object
191 192 193 194 195 196 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 191 def self.publish_show(distribution, prefix, = {}) cmd = aptly_command(, 'publish', 'show', '-json') cmd += () cmd << distribution << prefix execute_and_parse(cmd) end |
.publish_snapshot(names, prefix, options = {}) ⇒ Object
Publish
171 172 173 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 171 def self.publish_snapshot(names, prefix, = {}) publish_something('snapshot', names, prefix, ) end |
.publish_switch(distribution, prefix, snapshots, options = {}) ⇒ Object
179 180 181 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 179 def self.publish_switch(distribution, prefix, snapshots, = {}) publish_somehow('switch', distribution, prefix, snapshots, ) end |
.publish_update(distribution, prefix, options = {}) ⇒ Object
183 184 185 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 183 def self.publish_update(distribution, prefix, = {}) publish_somehow('update', distribution, prefix, nil, ) end |
.repo_add(name, package_or_directory, options = {}) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 102 def self.repo_add(name, package_or_directory, = {}) cmd = aptly_command(, 'repo', 'add') cmd += () cmd << '-force-replace' if [:force_replace] cmd << '-remove-files' if [:remove_files] cmd << name cmd << package_or_directory execute(cmd) end |
.repo_create(name, options = {}) ⇒ Object
Repo
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 88 def self.repo_create(name, = {}) cmd = aptly_command(, 'repo', 'create') cmd += () cmd << "-comment=#{[:comment]}" if [:comment] cmd << "-component=#{[:component]}" if [:component] cmd << "-distribution=#{[:distribution]}" if [:distribution] cmd << "-uploaders-file=#{[:uploaders_file]}" if [:uploaders_file] cmd << name cmd += ['from', 'snapshot', [:snapshot]] if [:snapshot] execute(cmd) end |
.repo_drop(name, options = {}) ⇒ Object
130 131 132 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 130 def self.repo_drop(name, = {}) something_drop('repo', name, ) end |
.repo_list(options = {}) ⇒ Object
122 123 124 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 122 def self.repo_list( = {}) something_list('repo', ) end |
.repo_remove(name, package_query, options = {}) ⇒ Object
113 114 115 116 117 118 119 120 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 113 def self.repo_remove(name, package_query, = {}) cmd = aptly_command(, 'repo', 'remove') cmd += () cmd << name cmd += Array(package_query) execute(cmd) end |
.repo_show(name, options = {}) ⇒ Object
126 127 128 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 126 def self.repo_show(name, = {}) something_show('repo', name, ) end |
.snapshot_create(name, from, options = {}) ⇒ Object
Snapshot
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 135 def self.snapshot_create(name, from, = {}) cmd = aptly_command(, 'snapshot', 'create') cmd += () cmd << name case from when 'mirror' raise PuppetX::Aptly::Error, '`mirror` option should be defined' unless [:mirror] cmd += ['from', 'mirror', [:mirror]] when 'repo' raise PuppetX::Aptly::Error, '`repo` option should be defined' unless [:repo] cmd += ['from', 'repo', [:repo]] when 'empty' cmd += %w[empty] else raise PuppetX::Aptly::Error, '`from` argument must be one of: mirror, repo, empty' end execute(cmd) end |
.snapshot_drop(name, options = {}) ⇒ Object
166 167 168 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 166 def self.snapshot_drop(name, = {}) something_drop('snapshot', name, ) end |
.snapshot_list(options = {}) ⇒ Object
158 159 160 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 158 def self.snapshot_list( = {}) something_list('snapshot', ) end |
.snapshot_show(name, options = {}) ⇒ Object
162 163 164 |
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 162 def self.snapshot_show(name, = {}) something_show('snapshot', name, ) end |