fog-proxmox 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +34 -49
  3. data/.github/workflows/release.yml +38 -0
  4. data/.rubocop.yml +11 -10
  5. data/.rubocop_todo.yml +255 -0
  6. data/CHANGELOG.md +8 -0
  7. data/README.md +28 -4
  8. data/Rakefile +8 -35
  9. data/bin/console +2 -4
  10. data/bin/setup +2 -4
  11. data/fog-proxmox.gemspec +7 -5
  12. data/lib/fog/proxmox/attributes.rb +3 -2
  13. data/lib/fog/proxmox/auth/token/access_ticket.rb +68 -57
  14. data/lib/fog/proxmox/auth/token/user_token.rb +79 -66
  15. data/lib/fog/proxmox/auth/token.rb +66 -60
  16. data/lib/fog/proxmox/compute/models/disk.rb +6 -1
  17. data/lib/fog/proxmox/compute/models/disks.rb +1 -1
  18. data/lib/fog/proxmox/compute/models/interface.rb +1 -1
  19. data/lib/fog/proxmox/compute/models/interfaces.rb +1 -1
  20. data/lib/fog/proxmox/compute/models/node.rb +3 -5
  21. data/lib/fog/proxmox/compute/models/nodes.rb +1 -1
  22. data/lib/fog/proxmox/compute/models/server.rb +27 -16
  23. data/lib/fog/proxmox/compute/models/server_config.rb +9 -4
  24. data/lib/fog/proxmox/compute/models/servers.rb +5 -5
  25. data/lib/fog/proxmox/compute/models/snapshots.rb +1 -1
  26. data/lib/fog/proxmox/compute/models/storage.rb +3 -2
  27. data/lib/fog/proxmox/compute/models/storages.rb +2 -2
  28. data/lib/fog/proxmox/compute/models/tasks.rb +1 -0
  29. data/lib/fog/proxmox/compute/models/volume.rb +2 -1
  30. data/lib/fog/proxmox/compute/models/volumes.rb +2 -2
  31. data/lib/fog/proxmox/compute/requests/get_server_config.rb +14 -14
  32. data/lib/fog/proxmox/compute/requests/get_server_status.rb +17 -17
  33. data/lib/fog/proxmox/compute/requests/log_task.rb +1 -1
  34. data/lib/fog/proxmox/core.rb +27 -24
  35. data/lib/fog/proxmox/errors.rb +2 -1
  36. data/lib/fog/proxmox/hash.rb +0 -2
  37. data/lib/fog/proxmox/helpers/controller_helper.rb +3 -4
  38. data/lib/fog/proxmox/helpers/cpu_helper.rb +13 -6
  39. data/lib/fog/proxmox/helpers/disk_helper.rb +17 -11
  40. data/lib/fog/proxmox/helpers/ip_helper.rb +21 -20
  41. data/lib/fog/proxmox/helpers/nic_helper.rb +13 -11
  42. data/lib/fog/proxmox/identity/models/domain.rb +7 -3
  43. data/lib/fog/proxmox/identity/models/domain_type.rb +0 -1
  44. data/lib/fog/proxmox/identity/models/domains.rb +1 -2
  45. data/lib/fog/proxmox/identity/models/group.rb +4 -2
  46. data/lib/fog/proxmox/identity/models/groups.rb +1 -1
  47. data/lib/fog/proxmox/identity/models/permission.rb +5 -4
  48. data/lib/fog/proxmox/identity/models/permissions.rb +3 -1
  49. data/lib/fog/proxmox/identity/models/pool.rb +4 -4
  50. data/lib/fog/proxmox/identity/models/pools.rb +4 -4
  51. data/lib/fog/proxmox/identity/models/role.rb +1 -1
  52. data/lib/fog/proxmox/identity/models/roles.rb +1 -1
  53. data/lib/fog/proxmox/identity/models/token.rb +4 -3
  54. data/lib/fog/proxmox/identity/models/token_info.rb +2 -2
  55. data/lib/fog/proxmox/identity/models/tokens.rb +9 -13
  56. data/lib/fog/proxmox/identity/models/user.rb +1 -2
  57. data/lib/fog/proxmox/identity/models/users.rb +1 -1
  58. data/lib/fog/proxmox/identity/requests/get_user.rb +1 -0
  59. data/lib/fog/proxmox/identity/requests/list_user_permissions.rb +1 -1
  60. data/lib/fog/proxmox/network/models/networks.rb +1 -1
  61. data/lib/fog/proxmox/network/models/node.rb +1 -0
  62. data/lib/fog/proxmox/network/models/nodes.rb +1 -1
  63. data/lib/fog/proxmox/string.rb +4 -3
  64. data/lib/fog/proxmox/version.rb +1 -1
  65. data/lib/fog/proxmox.rb +1 -3
  66. data/spec/hash_spec.rb +2 -1
  67. data/spec/helpers/controller_helper_spec.rb +135 -123
  68. data/spec/helpers/cpu_helper_spec.rb +58 -53
  69. data/spec/helpers/disk_helper_spec.rb +104 -54
  70. data/spec/helpers/ip_helper_spec.rb +155 -138
  71. data/spec/helpers/nic_helper_spec.rb +28 -19
  72. data/spec/identity_spec.rb +86 -74
  73. data/spec/proxmox_vcr.rb +2 -2
  74. data/tasks/audit.rake +25 -0
  75. data/tasks/lint.rake +22 -0
  76. data/tasks/test.rake +65 -0
  77. metadata +62 -47
  78. data/.codeclimate.yml +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e153a5fb10f314d09cc54eec5e8b2a6733120fe5c82ab6a809f203d2211fbfa
4
- data.tar.gz: 7f2aa37e3830abb05c6717dc3f9e1705bfb8aebfa6cf52b2726a81a430ce1ac9
3
+ metadata.gz: fbbd25ac2c953f21c2a4f5b9ab59e30269ab68f9f832abf4dc740743e10a93ec
4
+ data.tar.gz: 3c20988aca648ae685ce5c8e86c17af02ae667bbf6fe53ee012616fec2300ebe
5
5
  SHA512:
6
- metadata.gz: 615ea980593082a11de74ad48d342df7ea3d5af4a39c9ae467280990ec6fcbc54c6589fe40e824b0ce7429f041707eb6953f71eb6bc3bcd23146ba37d3d98737
7
- data.tar.gz: 73174f09ca4246a44b357d2f6c9b86daf01808623766877f04b59f210dcb581f056b32954aa9d2e919384d7a371bb0edbc720d3196867b9631cf8375d8f76e79
6
+ metadata.gz: 813919e970090cde4ccac7ec991b06f4a8380bdf0a1e0e85c0f5b73fce6da91d48da381bcba239ba995e5b706d80bf6b9123823f66420967685deb350dd30a22
7
+ data.tar.gz: 3d638a97782b63a70e12237e6494bf67386e019b287965eb02d36c92f7c097c36a443fe84b2e53464f13895984be7f9141171a4212fab8d3792d08ebab85920d
@@ -1,79 +1,64 @@
1
- name: CI
1
+ name: test
2
2
 
3
3
  on:
4
4
  push:
5
5
  branches: [ master ]
6
6
  pull_request:
7
- branches: [ master ]
8
- release:
9
- types: [created]
10
7
 
11
8
  jobs:
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.7
16
+ bundler-cache: true
17
+ - run: bundle install
18
+ - name: rubocop runs
19
+ run: bundle exec rake rubocop
12
20
  test:
21
+ needs: [lint]
13
22
  runs-on: ubuntu-latest
14
23
  steps:
15
- - uses: actions/checkout@v2
24
+ - uses: actions/checkout@v3
16
25
  - name: Set up Ruby
17
26
  uses: ruby/setup-ruby@v1
18
27
  with:
19
- ruby-version: 2.6
28
+ ruby-version: '2.7'
29
+ bundler-cache: true
20
30
  - name: Install dependencies
21
31
  run: bundle install
22
- - name: Run tests
23
- run: bundle exec rake test spec audit
24
- - name: Upload results for coverage
32
+ - name: Run tests with simplecov
33
+ run: bundle exec rake spec
34
+ env:
35
+ CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
36
+ - name: Run vulnerabilities check
37
+ run: bundle exec rake audit
38
+ - name: Upload simplecov results for coverage
25
39
  uses: actions/upload-artifact@v1
26
40
  with:
27
41
  name: coverage
28
42
  path: coverage/
29
43
 
30
44
  coverage:
31
- needs: [ test ]
45
+ needs: [ lint, test ]
32
46
  name: coverage
33
47
  runs-on: ubuntu-latest
34
- steps:
35
- - uses: actions/checkout@v2
48
+ steps:
49
+ - uses: actions/checkout@v3
36
50
  - name: Download tests result from test
37
51
  uses: actions/download-artifact@v1
38
52
  with:
39
53
  name: coverage
40
- - name: Install Code Climate test-reporter
41
- run: |
42
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
43
- chmod +x ./cc-test-reporter
44
- - name: Format code coverage
54
+ - name: Publish code coverage to codeclimate
55
+ uses: paambaati/codeclimate-action@v3.2.0
45
56
  env:
57
+ CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
46
58
  GIT_BRANCH: ${{ github.ref }}
47
59
  GIT_COMMIT_SHA: ${{ github.sha }}
48
- run: |
49
- export GIT_COMMITTED_AT="$(date +%s)"
50
- ./cc-test-reporter format-coverage -d -t simplecov -o coverage/codeclimate.json coverage/.resultset.json
51
- - name: Publish code coverage
52
- env:
53
- GIT_BRANCH: ${{ github.ref }}
54
- GIT_COMMIT_SHA: ${{ github.sha }}
55
- run: |
56
- export GIT_COMMITTED_AT="$(date +%s)"
57
- ./cc-test-reporter upload-coverage -d -r ${{secrets.CC_TEST_REPORTER_ID}}
58
-
59
- publish:
60
- needs: [ test ]
61
- name: publish
62
- runs-on: ubuntu-latest
63
- if: contains(github.ref, '/tags/v')
64
- steps:
65
- - uses: actions/checkout@v2
66
- - name: Set up Ruby 2.6
67
- uses: actions/setup-ruby@v1
68
- with:
69
- version: 2.6.x
70
- - name: Publish to RubyGems
71
- env:
72
- GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
73
- run: |
74
- mkdir -p $HOME/.gem
75
- touch $HOME/.gem/credentials
76
- chmod 0600 $HOME/.gem/credentials
77
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
78
- gem build *.gemspec
79
- gem push *.gem
60
+ with:
61
+ workingDirectory: coverage
62
+ debug: true
63
+ coverageLocations: |
64
+ ${{github.workspace}}/coverage/coverage.json:simplecov
@@ -0,0 +1,38 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ release-please:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: google-github-actions/release-please-action@v3
13
+ id: release
14
+ with:
15
+ release-type: ruby
16
+ package-name: fog-proxmox
17
+ bump-minor-pre-major: true
18
+ version-file: "lib/fog/proxmox/version.rb"
19
+ - uses: actions/checkout@v3
20
+ if: ${{ steps.release.outputs.release_created }}
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '2.7'
24
+ bundler-cache: true
25
+ if: ${{ steps.release.outputs.release_created }}
26
+ - run: bundle install
27
+ if: ${{ steps.release.outputs.release_created }}
28
+ - name: publish gem
29
+ run: |
30
+ mkdir -p $HOME/.gem
31
+ touch $HOME/.gem/credentials
32
+ chmod 0600 $HOME/.gem/credentials
33
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
34
+ gem build *.gemspec
35
+ gem push *.gem
36
+ env:
37
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
38
+ if: ${{ steps.release.outputs.release_created }}
data/.rubocop.yml CHANGED
@@ -1,13 +1,14 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
3
+ require:
4
+ - rubocop-minitest
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
1
8
  AllCops:
2
- TargetRubyVersion: 2.4
3
- Include:
4
- - '**/Rakefile'
9
+ TargetRubyVersion: 2.5
10
+ NewCops: disable
5
11
  Exclude:
6
- - 'bin/**/*'
12
+ - 'examples/**/*'
7
13
  - 'vendor/**/*'
8
- - 'coverage/**/*'
9
- - '.bundle/**/*'
10
- - '.vscode/**/*'
11
- - '**/*.gemspec'
12
- - 'Gemfile'
13
- - 'spec/**/*'
14
+ - 'bin/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,255 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-12-01 11:01:10 UTC using RuboCop version 1.39.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ # Configuration parameters: AllowSafeAssignment.
11
+ Lint/AssignmentInCondition:
12
+ Exclude:
13
+ - 'lib/fog/proxmox/helpers/ip_helper.rb'
14
+
15
+ # Offense count: 1
16
+ Lint/MixedRegexpCaptureTypes:
17
+ Exclude:
18
+ - 'lib/fog/proxmox/helpers/cpu_helper.rb'
19
+
20
+ # Offense count: 1
21
+ # This cop supports unsafe autocorrection (--autocorrect-all).
22
+ Lint/PercentStringArray:
23
+ Exclude:
24
+ - 'lib/fog/proxmox/core.rb'
25
+
26
+ # Offense count: 13
27
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
28
+ Metrics/AbcSize:
29
+ Max: 46
30
+
31
+ # Offense count: 1
32
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
33
+ # AllowedMethods: refine
34
+ Metrics/BlockLength:
35
+ Max: 40
36
+
37
+ # Offense count: 2
38
+ # Configuration parameters: CountComments, CountAsOne.
39
+ Metrics/ClassLength:
40
+ Max: 200
41
+
42
+ # Offense count: 5
43
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
44
+ Metrics/CyclomaticComplexity:
45
+ Max: 17
46
+
47
+ # Offense count: 18
48
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
49
+ Metrics/MethodLength:
50
+ Max: 70
51
+
52
+ # Offense count: 2
53
+ # Configuration parameters: CountComments, CountAsOne.
54
+ Metrics/ModuleLength:
55
+ Max: 133
56
+
57
+ # Offense count: 5
58
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
59
+ Metrics/PerceivedComplexity:
60
+ Max: 19
61
+
62
+ # Offense count: 3
63
+ Naming/AccessorMethodName:
64
+ Exclude:
65
+ - 'lib/fog/proxmox/auth/token/user_token.rb'
66
+ - 'lib/fog/proxmox/network/requests/get_network.rb'
67
+ - 'lib/fog/proxmox/network/requests/get_node.rb'
68
+
69
+ # Offense count: 6
70
+ Naming/ConstantName:
71
+ Exclude:
72
+ - 'lib/fog/proxmox/helpers/ip_helper.rb'
73
+
74
+ # Offense count: 6
75
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
76
+ # NamePrefix: is_, has_, have_
77
+ # ForbiddenPrefixes: is_, has_, have_
78
+ # AllowedMethods: is_a?
79
+ # MethodDefinitionMacros: define_method, define_singleton_method
80
+ Naming/PredicateName:
81
+ Exclude:
82
+ - 'spec/**/*'
83
+ - 'lib/fog/proxmox/compute/models/disk.rb'
84
+ - 'lib/fog/proxmox/helpers/nic_helper.rb'
85
+ - 'lib/fog/proxmox/identity/models/pool.rb'
86
+
87
+ # Offense count: 3
88
+ RSpec/BeforeAfterAll:
89
+ Exclude:
90
+ - 'spec/spec_helper.rb'
91
+ - 'spec/rails_helper.rb'
92
+ - 'spec/support/**/*.rb'
93
+ - 'spec/compute_spec.rb'
94
+ - 'spec/identity_spec.rb'
95
+ - 'spec/network_spec.rb'
96
+
97
+ # Offense count: 131
98
+ # This cop supports unsafe autocorrection (--autocorrect-all).
99
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
100
+ # SupportedStyles: described_class, explicit
101
+ RSpec/DescribedClass:
102
+ Exclude:
103
+ - 'spec/compute_spec.rb'
104
+ - 'spec/hash_spec.rb'
105
+ - 'spec/helpers/controller_helper_spec.rb'
106
+ - 'spec/helpers/cpu_helper_spec.rb'
107
+ - 'spec/helpers/disk_helper_spec.rb'
108
+ - 'spec/helpers/ip_helper_spec.rb'
109
+ - 'spec/helpers/nic_helper_spec.rb'
110
+ - 'spec/identity_spec.rb'
111
+ - 'spec/network_spec.rb'
112
+
113
+ # Offense count: 17
114
+ # Configuration parameters: CountAsOne.
115
+ RSpec/ExampleLength:
116
+ Max: 136
117
+
118
+ # Offense count: 9
119
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
120
+ # Include: **/*_spec*rb*, **/spec/**/*
121
+ RSpec/FilePath:
122
+ Exclude:
123
+ - 'spec/compute_spec.rb'
124
+ - 'spec/hash_spec.rb'
125
+ - 'spec/helpers/controller_helper_spec.rb'
126
+ - 'spec/helpers/cpu_helper_spec.rb'
127
+ - 'spec/helpers/disk_helper_spec.rb'
128
+ - 'spec/helpers/ip_helper_spec.rb'
129
+ - 'spec/helpers/nic_helper_spec.rb'
130
+ - 'spec/identity_spec.rb'
131
+ - 'spec/network_spec.rb'
132
+
133
+ # Offense count: 114
134
+ # Configuration parameters: AssignmentOnly.
135
+ RSpec/InstanceVariable:
136
+ Exclude:
137
+ - 'spec/compute_spec.rb'
138
+ - 'spec/identity_spec.rb'
139
+ - 'spec/network_spec.rb'
140
+
141
+ # Offense count: 32
142
+ # Configuration parameters: AllowSubject.
143
+ RSpec/MultipleMemoizedHelpers:
144
+ Max: 12
145
+
146
+ # Offense count: 2
147
+ RSpec/RepeatedDescription:
148
+ Exclude:
149
+ - 'spec/helpers/cpu_helper_spec.rb'
150
+
151
+ # Offense count: 1
152
+ # This cop supports unsafe autocorrection (--autocorrect-all).
153
+ Style/CaseLikeIf:
154
+ Exclude:
155
+ - 'lib/fog/proxmox/auth/token.rb'
156
+
157
+ # Offense count: 3
158
+ # Configuration parameters: AllowedConstants.
159
+ Style/Documentation:
160
+ Exclude:
161
+ - 'spec/**/*'
162
+ - 'test/**/*'
163
+ - 'lib/fog/proxmox/auth/token.rb'
164
+ - 'lib/fog/proxmox/auth/token/access_ticket.rb'
165
+ - 'lib/fog/proxmox/auth/token/user_token.rb'
166
+
167
+ # Offense count: 2
168
+ # This cop supports unsafe autocorrection (--autocorrect-all).
169
+ # Configuration parameters: EnforcedStyle.
170
+ # SupportedStyles: always, always_true, never
171
+ Style/FrozenStringLiteralComment:
172
+ Exclude:
173
+ - 'lib/fog/proxmox/identity/models/domain.rb'
174
+ - 'lib/fog/proxmox/identity/models/domain_type.rb'
175
+
176
+ # Offense count: 2
177
+ # This cop supports safe autocorrection (--autocorrect).
178
+ Style/IfUnlessModifier:
179
+ Exclude:
180
+ - 'lib/fog/proxmox/auth/token/access_ticket.rb'
181
+ - 'lib/fog/proxmox/compute/models/servers.rb'
182
+
183
+ # Offense count: 12
184
+ # This cop supports unsafe autocorrection (--autocorrect-all).
185
+ # Configuration parameters: EnforcedStyle.
186
+ # SupportedStyles: literals, strict
187
+ Style/MutableConstant:
188
+ Exclude:
189
+ - 'lib/fog/proxmox/helpers/cpu_helper.rb'
190
+ - 'lib/fog/proxmox/helpers/disk_helper.rb'
191
+ - 'lib/fog/proxmox/helpers/ip_helper.rb'
192
+ - 'lib/fog/proxmox/helpers/nic_helper.rb'
193
+
194
+ # Offense count: 2
195
+ # This cop supports unsafe autocorrection (--autocorrect-all).
196
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
197
+ # SupportedStyles: predicate, comparison
198
+ Style/NumericPredicate:
199
+ Exclude:
200
+ - 'spec/**/*'
201
+ - 'lib/fog/proxmox/core.rb'
202
+ - 'lib/fog/proxmox/helpers/cpu_helper.rb'
203
+
204
+ # Offense count: 1
205
+ # Configuration parameters: AllowedMethods.
206
+ # AllowedMethods: respond_to_missing?
207
+ Style/OptionalBooleanParameter:
208
+ Exclude:
209
+ - 'lib/fog/proxmox/identity/models/pool.rb'
210
+
211
+ # Offense count: 20
212
+ # This cop supports unsafe autocorrection (--autocorrect-all).
213
+ # Configuration parameters: EnforcedStyle.
214
+ # SupportedStyles: short, verbose
215
+ Style/PreferredHashMethods:
216
+ Exclude:
217
+ - 'lib/fog/proxmox/compute/models/servers.rb'
218
+ - 'lib/fog/proxmox/helpers/nic_helper.rb'
219
+ - 'lib/fog/proxmox/identity/models/domain.rb'
220
+ - 'lib/fog/proxmox/identity/models/pool.rb'
221
+ - 'spec/helpers/controller_helper_spec.rb'
222
+ - 'spec/helpers/nic_helper_spec.rb'
223
+
224
+ # Offense count: 4
225
+ # This cop supports unsafe autocorrection (--autocorrect-all).
226
+ Style/RedundantInterpolation:
227
+ Exclude:
228
+ - 'lib/fog/proxmox/helpers/ip_helper.rb'
229
+
230
+ # Offense count: 11
231
+ # This cop supports unsafe autocorrection (--autocorrect-all).
232
+ # Configuration parameters: Mode.
233
+ Style/StringConcatenation:
234
+ Exclude:
235
+ - 'lib/fog/proxmox/compute/models/server.rb'
236
+ - 'lib/fog/proxmox/compute/models/tasks.rb'
237
+ - 'lib/fog/proxmox/helpers/cpu_helper.rb'
238
+ - 'lib/fog/proxmox/helpers/disk_helper.rb'
239
+ - 'lib/fog/proxmox/helpers/nic_helper.rb'
240
+ - 'lib/fog/proxmox/variables.rb'
241
+
242
+ # Offense count: 2
243
+ # This cop supports unsafe autocorrection (--autocorrect-all).
244
+ # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowComments.
245
+ # AllowedMethods: respond_to, define_method
246
+ Style/SymbolProc:
247
+ Exclude:
248
+ - 'spec/compute_spec.rb'
249
+
250
+ # Offense count: 16
251
+ # This cop supports safe autocorrection (--autocorrect).
252
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
253
+ # URISchemes: http, https
254
+ Layout/LineLength:
255
+ Max: 230
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [0.15.0](https://github.com/fog/fog-proxmox/compare/v0.14.0...v0.15.0) (2022-12-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * :sparkles: memory unit is Mb and disk size is Gb ([c5410b5](https://github.com/fog/fog-proxmox/commit/c5410b5c79ed59a89bb4f0f2188613cbcc6a8f11))
data/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  # Fog::Proxmox
4
4
 
5
5
  ![CI](https://github.com/fog/fog-proxmox/workflows/CI/badge.svg)
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/33e619f2167cc9864b61/maintainability)](https://codeclimate.com/github/fog/fog-proxmox/maintainability)
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/33e619f2167cc9864b61/test_coverage)](https://codeclimate.com/github/fog/fog-proxmox/test_coverage)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/dfcdcc32f096abf1b2b4/maintainability)](https://codeclimate.com/github/fog/fog-proxmox/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/dfcdcc32f096abf1b2b4/test_coverage)](https://codeclimate.com/github/fog/fog-proxmox/test_coverage)
8
8
  [![Gem Version](https://badge.fury.io/rb/fog-proxmox.svg)](https://badge.fury.io/rb/fog-proxmox)
9
9
 
10
10
  This is a [FOG](http://fog.io/) (>= 2.1) module gem to support [Proxmox VE](https://www.proxmox.com/en/proxmox-ve)
@@ -62,16 +62,40 @@ To record your VCR cassettes:
62
62
  PROXMOX_URL=https://192.168.56.101:8006/api2/json DISABLE_PROXY=true SSL_VERIFY_PEER=false bundle exec rake spec
63
63
  ```
64
64
 
65
- To replay your recorded tests:
65
+ To replay all your recorded tests:
66
66
 
67
67
  ```shell
68
68
  USE_VCR=true bundle exec rake spec
69
69
  ```
70
70
 
71
+ To replay one group (compute, identity or network) of your recorded tests:
72
+
73
+ ```shell
74
+ USE_VCR=true bundle exec rake spec:compute
75
+ ```
76
+
71
77
  Code formatting:
72
78
 
73
79
  ```shell
74
- bundle exec bin/rake rubocop
80
+ bundle exec rake rubocop
81
+ ```
82
+
83
+ Auto correcting (safe):
84
+
85
+ ```shell
86
+ bundle exec rake rubocop:autocorrect
87
+ ```
88
+
89
+ Exclude cops in todo file:
90
+
91
+ ```shell
92
+ bundle exec rubocop --auto-gen-config
93
+ ```
94
+
95
+ See all available rake tasks:
96
+
97
+ ```shell
98
+ bundle exec rake --tasks
75
99
  ```
76
100
 
77
101
  ## Contributing
data/Rakefile CHANGED
@@ -17,42 +17,15 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- require 'bundler/gem_tasks'
21
- require 'rubocop/rake_task'
22
20
  require 'rake/testtask'
23
- require 'bundler/audit/task'
24
21
 
25
- Bundler::Audit::Task.new
26
- RuboCop::RakeTask.new
27
-
28
- task default: :test
29
-
30
- desc 'Run fog-proxmox unit tests with Minitest'
31
- task :test do
32
- mock = ENV['FOG_MOCK'] || 'true'
33
- sh("export FOG_MOCK=#{mock} && bundle exec rake tests:unit")
22
+ task_dir = File.expand_path('tasks', __dir__)
23
+ Dir["#{task_dir}/**/*.rake"].each do |task_file|
24
+ load task_file
34
25
  end
35
26
 
36
- desc 'Run fog-proxmox spec/ tests (VCR)'
37
- task spec: 'tests:spec'
38
-
39
- desc 'Run audit vulnerabilities'
40
- task audit: 'bundle:audit'
41
-
42
- namespace :tests do
43
- desc 'Run fog-proxmox test/'
44
- Rake::TestTask.new do |t|
45
- t.name = 'unit'
46
- t.libs.push %w[lib test]
47
- t.test_files = FileList['test/**/*.rb']
48
- t.verbose = true
49
- end
50
-
51
- desc 'Run fog-proxmox spec/'
52
- Rake::TestTask.new do |t|
53
- t.name = 'spec'
54
- t.libs.push %w[lib spec]
55
- t.pattern = 'spec/**/*_spec.rb'
56
- t.verbose = true
57
- end
58
- end
27
+ desc 'Default Task'
28
+ task default: :spec
29
+
30
+ desc 'Alias of spec:all'
31
+ task spec: 'spec:all'
data/bin/console CHANGED
@@ -8,11 +8,9 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
14
12
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
14
 
17
15
  if File.file?(bundle_binstub)
18
16
  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
data/bin/setup CHANGED
@@ -8,11 +8,9 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
14
12
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
14
 
17
15
  if File.file?(bundle_binstub)
18
16
  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
data/fog-proxmox.gemspec CHANGED
@@ -33,11 +33,9 @@ Gem::Specification.new do |spec|
33
33
  spec.license = 'GPL-3.0'
34
34
 
35
35
  spec.files = `git ls-files -z`.split("\x0")
36
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
37
36
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
38
37
  spec.require_paths = ['lib']
39
38
  spec.required_ruby_version = '>= 2.5'
40
- spec.rubygems_version = '~> 2.6'
41
39
 
42
40
  spec.add_development_dependency 'bundler', '~> 2.1'
43
41
  spec.add_development_dependency 'bundler-audit', '~> 0.6'
@@ -49,15 +47,19 @@ Gem::Specification.new do |spec|
49
47
  spec.add_development_dependency 'pry', '~> 0.11'
50
48
  spec.add_development_dependency 'rake', '~> 12.3'
51
49
  spec.add_development_dependency 'rcodetools', '~> 0.3'
52
- spec.add_development_dependency 'reek', '~> 4.7'
50
+ spec.add_development_dependency 'reek', '~> 6.1'
53
51
  spec.add_development_dependency 'rspec', '~> 3.7'
54
- spec.add_development_dependency 'rubocop', '~> 0.55'
52
+ spec.add_development_dependency 'rubocop', '~> 1.39'
53
+ spec.add_development_dependency 'rubocop-minitest', '~> 0.24'
54
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
55
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.15'
55
56
  spec.add_development_dependency 'ruby-debug-ide', '~> 0.6'
56
- spec.add_development_dependency 'simplecov', '0.17'
57
+ spec.add_development_dependency 'simplecov', '~> 0.21'
57
58
  spec.add_development_dependency 'vcr', '~> 4.0'
58
59
  spec.add_development_dependency 'webmock', '~> 3.5'
59
60
 
60
61
  spec.add_dependency 'fog-core', '~> 2.1'
61
62
  spec.add_dependency 'fog-json', '~> 1.2'
62
63
  spec.add_dependency 'ipaddress', '~> 0.8'
64
+ spec.metadata['rubygems_mfa_required'] = 'true'
63
65
  end
@@ -24,9 +24,10 @@ module Fog
24
24
  def self.set_attr(attr_name, attributes, new_attributes)
25
25
  attributes[attr_name.to_sym] = new_attributes[attr_name] unless new_attributes[attr_name].nil?
26
26
  end
27
+
27
28
  def self.set_attr_and_sym(attr_name, attributes, new_attributes)
28
- self.set_attr(attr_name, attributes, new_attributes)
29
- self.set_attr(attr_name.to_sym, attributes, new_attributes)
29
+ set_attr(attr_name, attributes, new_attributes)
30
+ set_attr(attr_name.to_sym, attributes, new_attributes)
30
31
  end
31
32
  end
32
33
  end