Class: PuppetX::Aptly::CliHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/voxpupuli/aptly/cli_helper.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.aptlyObject

Returns the value of attribute aptly.



17
18
19
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 17

def aptly
  @aptly
end

Class Method Details

.mirror_create(name, url, distribution, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 20

def self.mirror_create(name, url, distribution, options = {})
  cmd = [@aptly, 'mirror', 'create']
  cmd += parse_common_options(options)
  cmd << "-filter=#{options[:filter]}" if options[:filter]
  cmd << '-filter-with-deps' if options[:filter_with_deps]
  cmd << '-force-architectures' if options[:force_architectures]
  cmd << '-force-components' if options[:force_components]
  cmd << '-ignore-signatures' if options[:ignore_signatures]
  cmd += Array(options[:keyring]).map { |x| "-keyring=#{x}" }
  cmd << "-max-tries=#{options[:max_tries]}" if options[:max_tries]
  cmd << '-with-installer' if options[:with_installer]
  cmd << '-with-sources' if options[:with_sources]
  cmd << '-with-udebs' if options[:with_udebs]
  cmd += [name, url, distribution]
  cmd += Array(options[:component])
  execute(cmd)
end

.mirror_drop(name, options = {}) ⇒ Object



57
58
59
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 57

def self.mirror_drop(name, options = {})
  something_drop('mirror', name, options)
end

.mirror_edit(name, options = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 61

def self.mirror_edit(name, options = {})
  cmd = [@aptly, 'mirror', 'edit']
  cmd += parse_common_options(options)
  cmd << "-archive-url=#{options[:archive_url]}" if options[:archive_url]
  cmd << "-filter=#{options[:filter]}" if options[:filter]
  cmd << '-filter-with-deps' if options[:filter_with_deps]
  cmd << '-ignore-signatures' if options[:ignore_signatures]
  cmd += Array(options[:keyring]).map { |x| "-keyring=#{x}" }
  cmd << '-with-installer' if options[:with_installer]
  cmd << '-with-sources' if options[:with_sources]
  cmd << '-with-udebs' if options[:with_udebs]
  cmd << name

  execute(cmd)
end

.mirror_list(options = {}) ⇒ Object



53
54
55
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 53

def self.mirror_list(options = {})
  something_list('mirror', options)
end

.mirror_update(name, options = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 38

def self.mirror_update(name, options = {})
  cmd = [@aptly, 'mirror', 'update']
  cmd += parse_common_options(options)
  cmd << "-download-limit=#{options[:download_limit]}" if options[:download_limit]
  cmd << "-downloader=#{options[:downloader]}" if options[:downloader]
  cmd << '-force' if options[:force]
  cmd << '-ignore-checksums' if options[:ignore_checksums]
  cmd << '-ignore-signatures' if options[:ignore_signatures]
  cmd += Array(options[:keyring]).map { |x| "-keyring=#{x}" }
  cmd << "-max-tries=#{options[:max_tries]}" if options[:max_tries]
  cmd << '-skip-existing-packages' if options[:skip_existing_packages]
  cmd << name
  execute(cmd)
end

.publish_drop(distribution, prefix, options = {}) ⇒ Object



170
171
172
173
174
175
176
177
178
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 170

def self.publish_drop(distribution, prefix, options = {})
  cmd = [@aptly, 'publish', 'drop']
  cmd += parse_common_options(options)
  cmd << '-force-drop' if options[:force_drop]
  cmd << '-skip-cleanup' if options[:skip_cleanup]
  cmd << distribution
  cmd << prefix
  execute(cmd)
end

.publish_list(options = {}) ⇒ Object



166
167
168
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 166

def self.publish_list(options = {})
  something_list('publish', options)
end

.publish_repo(names, prefix, options = {}) ⇒ Object



154
155
156
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 154

def self.publish_repo(names, prefix, options = {})
  publish_something('repo', names, prefix, options)
end

.publish_snapshot(names, prefix, options = {}) ⇒ Object



150
151
152
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 150

def self.publish_snapshot(names, prefix, options = {})
  publish_something('snapshot', names, prefix, options)
end

.publish_switch(distribution, prefix, snapshots, options = {}) ⇒ Object



158
159
160
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 158

def self.publish_switch(distribution, prefix, snapshots, options = {})
  publish_somehow('switch', distribution, prefix, snapshots, options)
end

.publish_update(distribution, prefix, options = {}) ⇒ Object



162
163
164
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 162

def self.publish_update(distribution, prefix, options = {})
  publish_somehow('update', distribution, prefix, nil, options)
end

.repo_add(name, package_or_directory, options = {}) ⇒ Object



91
92
93
94
95
96
97
98
99
100
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 91

def self.repo_add(name, package_or_directory, options = {})
  cmd = [@aptly, 'repo', 'add']
  cmd += parse_common_options(options)
  cmd << '-force-replace' if options[:force_replace]
  cmd << '-remove-files' if options[:remove_files]
  cmd << name
  cmd << package_or_directory

  execute(cmd)
end

.repo_create(name, options = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 77

def self.repo_create(name, options = {})
  cmd = [@aptly, 'repo', 'create']
  cmd += parse_common_options(options)
  cmd << "-comment=#{options[:comment]}" if options[:comment]
  cmd << "-component=#{options[:component]}" if options[:component]
  cmd << "-distribution=#{options[:distribution]}" if options[:distribution]
  cmd << "-uploaders-file=#{options[:uploaders_file]}" if options[:uploaders_file]
  cmd << name

  cmd += ['from', 'snapshot', options[:snapshot]] if options[:snapshot]

  execute(cmd)
end

.repo_drop(name, options = {}) ⇒ Object



115
116
117
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 115

def self.repo_drop(name, options = {})
  something_drop('repo', name, options)
end

.repo_list(options = {}) ⇒ Object



111
112
113
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 111

def self.repo_list(options = {})
  something_list('repo', options)
end

.repo_remove(name, package_query, options = {}) ⇒ Object



102
103
104
105
106
107
108
109
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 102

def self.repo_remove(name, package_query, options = {})
  cmd = [@aptly, 'repo', 'remove']
  cmd += parse_common_options(options)
  cmd << name
  cmd += Array(package_query)

  execute(cmd)
end

.snapshot_create(name, from, options = {}) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 119

def self.snapshot_create(name, from, options = {})
  cmd = [@aptly, 'snapshot', 'create']
  cmd += parse_common_options(options)
  cmd << name

  case from
  when 'mirror'
    raise PuppetX::Aptly::Error, '`mirror` option should be defined' unless options[:mirror]

    cmd += ['from', 'mirror', options[:mirror]]
  when 'repo'
    raise PuppetX::Aptly::Error, '`repo` option should be defined' unless options[:repo]

    cmd += ['from', 'repo', options[: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



146
147
148
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 146

def self.snapshot_drop(name, options = {})
  something_drop('snapshot', name, options)
end

.snapshot_list(options = {}) ⇒ Object



142
143
144
# File 'lib/puppet_x/voxpupuli/aptly/cli_helper.rb', line 142

def self.snapshot_list(options = {})
  something_list('snapshot', options)
end