modules/mu/master.rb in cloud-mu-1.9.0.pre.beta vs modules/mu/master.rb in cloud-mu-2.0.0.pre.alpha
- old
+ new
@@ -188,18 +188,18 @@
def self.disk(device, path, size = 50, cryptfile = nil, ramdisk = "ram7")
temp_dev = "/dev/#{ramdisk}"
if !File.open("/etc/mtab").read.match(/ #{path} /)
realdevice = device.dup
- if MU::Cloud::Google.hosted
+ if MU::Cloud::Google.hosted?
realdevice = "/dev/disk/by-id/google-"+device.gsub(/.*?\/([^\/]+)$/, '\1')
end
alias_device = cryptfile ? "/dev/mapper/"+path.gsub(/[^0-9a-z_\-]/i, "_") : realdevice
if !File.exists?(realdevice)
MU.log "Creating #{path} volume"
- if MU::Cloud::AWS.hosted
+ if MU::Cloud::AWS.hosted?
dummy_svr = MU::Cloud::AWS::Server.new(
mu_name: "MU-MASTER",
cloud_id: MU.myInstanceId,
kitten_cfg: {}
)
@@ -208,11 +208,11 @@
MU.myInstanceId,
device: device,
tag_name: "Name",
tag_value: "#{$MU_CFG['hostname']} #{path}"
)
- elsif MU::Cloud::Google.hosted
+ elsif MU::Cloud::Google.hosted?
dummy_svr = MU::Cloud::Google::Server.new(
mu_name: "MU-MASTER",
cloud_id: MU.myInstanceId,
kitten_cfg: { 'project' => MU::Cloud::Google.myProject, 'availability_zone' => MU.myAZ }
)
@@ -222,19 +222,19 @@
end
end
if cryptfile
body = nil
- if MU::Cloud::AWS.hosted
+ if MU::Cloud::AWS.hosted?
begin
resp = MU::Cloud::AWS.s3.get_object(bucket: MU.adminBucketName, key: cryptfile)
body = resp.body
rescue Exception => e
MU.log "Failed to fetch #{cryptfile} from S3 bucket #{MU.adminBucketName}", MU::ERR, details: e.inspect
%x{/bin/dd if=/dev/urandom of=#{temp_dev} bs=1M count=1 > /dev/null 2>&1}
raise e
end
- elsif MU::Cloud::Google.hosted
+ elsif MU::Cloud::Google.hosted?
begin
body = MU::Cloud::Google.storage.get_object(MU.adminBucketName, cryptfile)
rescue Exception => e
MU.log "Failed to fetch #{cryptfile} from Cloud Storage bucket #{MU.adminBucketName}", MU::ERR, details: e.inspect
%x{/bin/dd if=/dev/urandom of=#{temp_dev} bs=1M count=1 > /dev/null 2>&1}