Update resources to be rubocop compliant

- Update rubocop config to include resources/**
- Update resources to comply with rubocop

Change-Id: Ia86977b706c259e81f67dab1287b24bf6a975e35
Implements: blueprint rubocop-for-object-storage
This commit is contained in:
Christopher H. Laco
2014-02-03 12:00:37 -05:00
parent a399e066b9
commit f90ec1ad45
4 changed files with 70 additions and 75 deletions

View File

@@ -5,9 +5,9 @@ AllCops:
- attributes/**
- providers/**
- recipes/**
- resources/**
Excludes:
- libraries/**
- resources/**
- spec/**
Encoding:

View File

@@ -1,3 +1,4 @@
# encoding: UTF-8
#
# Copyright 2011, Dell
#
@@ -16,18 +17,16 @@
# Author: andi abes
#
=begin
Ensure that a disk's partition table matches expectations.
Sample use:
openstack_object_storage_disk "/dev/sdb" do
part(
{[:type => "xfs", :size =>swift_disk::ONE_GIG*4 ],
[:type => "xfs", :size =>swift_disk::remaining})
action :ensure_exists
end
=end
# Ensure that a disk's partition table matches expectations.
# Sample use:
#
# openstack_object_storage_disk '/dev/sdb' do
# part([
# { type: "xfs", size: swift_disk::ONE_GIG*4 },
# { type: "xfs", size: swift_disk::remaining }
# ])
# action :ensure_exists
# end
actions :ensure_exists
@@ -36,9 +35,9 @@ def initialize(*args)
@action = :ensure_exists
end
attribute :name, :kind_of => String
attribute :size, :kind_of => Integer
attribute :blocks, :kind_of => Integer
attribute :device, :kind_of => String
attribute :part, :kind_of => Array
attribute :status, :kind_of => Symbol
attribute :name, kind_of: String
attribute :size, kind_of: Integer
attribute :blocks, kind_of: Integer
attribute :device, kind_of: String
attribute :part, kind_of: Array
attribute :status, kind_of: Symbol

View File

@@ -1,3 +1,4 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-object-storage
# Resource:: mounts
@@ -19,43 +20,40 @@
# Author: Ron Pedde <ron.pedde@rackspace.com>
#
=begin
Ensure that swift mounts are strongly enforced. This
will ensure specified drives are mounted, and unspecified
drives are not mounted. In addition, if there is a stale
mountpoint (from disk failure, maybe?), then that mountpoint
will try to be unmounted
# Ensure that swift mounts are strongly enforced. This
# will ensure specified drives are mounted, and unspecified
# drives are not mounted. In addition, if there is a stale
# mountpoint (from disk failure, maybe?), then that mountpoint
# will try to be unmounted
#
# Sample use:
#
# openstack_object_storage_mounts '/srv/node' do
# devices [ 'sdb1', 'sdc1' ]
# action :ensure_exists
# ip '10.1.1.1'
# end
Sample use:
# It will force mounts based on fs uuid (mangled to remove
# dashes) and return a structure that describes the disks
# mounted.
openstack_object_storage_mounts "/srv/node" do
devices [ "sdb1", "sdc1" ]
action :ensure_exists
ip "10.1.1.1"
end
# As this is expected to be consumed for the purposes of
# swift, the ip address should be the address that gets
# embedded into the ring (i.e. the listen port of the storage server)
It will force mounts based on fs uuid (mangled to remove
dashes) and return a structure that describes the disks
mounted.
# Example return structure:
As this is expected to be consumed for the purposes of
swift, the ip address should be the address that gets
embedded into the ring (i.e. the listen port of the storage server)
Example return structure:
{ "2a9452c5-d929-43d9-9631-4340ace45279": {
"device": "sdb1",
"ip": "10.1.1.1",
"mounted": "true",
"mountpoint": "2a9452c5d92943d996314340ace45279",
"size": 1022 (in 1k increments)
"uuid": "2a9452c5-d929-43d9-9631-4340ace45279"
},
...
}
=end
# { '2a9452c5-d929-43d9-9631-4340ace45279': {
# 'device': 'sdb1',
# 'ip': '10.1.1.1',
# 'mounted': 'true',
# 'mountpoint': '2a9452c5d92943d996314340ace45279',
# 'size': 1022 (in 1k increments)
# 'uuid': '2a9452c5-d929-43d9-9631-4340ace45279'
# },
# ...
# }
actions :ensure_exists
@@ -64,8 +62,8 @@ def initialize(*args)
@action = :ensure_exists
end
attribute :name, :kind_of => String
attribute :devices, :kind_of => Array
attribute :ip, :kind_of => String, :default => "127.0.0.1"
attribute :publish_attributes, :kind_of => String, :default => nil
attribute :format, :kind_of => String, :default => "xfs"
attribute :name, kind_of: String
attribute :devices, kind_of: Array
attribute :ip, kind_of: String, default: '127.0.0.1'
attribute :publish_attributes, kind_of: String, default: nil
attribute :format, kind_of: String, default: 'xfs'

View File

@@ -1,3 +1,4 @@
# encoding: UTF-8
#
# Copyright 2012, Rackspace US, Inc.
#
@@ -16,19 +17,16 @@
# Author: Ron Pedde <ron.pedde@rackspace.com>
#
=begin
Build a proposed ring-building script
Sample use:
openstack_object_storage_ring_script "/tmp/build-rings.sh" do
owner "root"
group "swift"
mode "0700"
ring_path "/etc/swift/ring-workspace"
action :ensure_exists
end
=end
# Build a proposed ring-building script
# Sample use:
#
# openstack_object_storage_ring_script '/tmp/build-rings.sh' do
# owner 'root'
# group 'swift'
# mode '0700'
# ring_path '/etc/swift/ring-workspace'
# action :ensure_exists
# end
actions :ensure_exists
@@ -37,8 +35,8 @@ def initialize(*args)
@action = :ensure_exists
end
attribute :name, :kind_of => String
attribute :owner, :kind_of => String, :default => "root"
attribute :group, :kind_of => String, :default => "root"
attribute :mode, :kind_of => String, :default => "0600"
attribute :ring_path, :kind_of => String, :default => "/etc/swift"
attribute :name, kind_of: String
attribute :owner, kind_of: String, default: 'root'
attribute :group, kind_of: String, default: 'root'
attribute :mode, kind_of: String, default: '0600'
attribute :ring_path, kind_of: String, default: '/etc/swift'