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/** - attributes/**
- providers/** - providers/**
- recipes/** - recipes/**
- resources/**
Excludes: Excludes:
- libraries/** - libraries/**
- resources/**
- spec/** - spec/**
Encoding: Encoding:

View File

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

View File

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

View File

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