bin/netseg-update in ruby-jss-1.0.0b2 vs bin/netseg-update in ruby-jss-1.0.0b6
- old
+ new
@@ -320,12 +320,11 @@
puts "Without --no-op this would: Add segment named '#{seg}', #{seg_data[:starting]}#{connector}#{seg_data[:ending]}"
next
end # if noop
ender = @use_cidr ? :cidr : :ending_address
- new_seg = JSS::NetworkSegment.new(
- :id => :new,
+ new_seg = JSS::NetworkSegment.make(
:name => seg,
:starting_address => seg_data[:starting],
ender => seg_data[:ending]
)
new_seg.create
@@ -337,11 +336,11 @@
@segments_to_delete.each do |seg|
if @noop
puts "Without --no-op this would: Delete segment named '#{seg}',"
next
end # if noop
- JSS::NetworkSegment.new(name: seg).delete
+ JSS::NetworkSegment.fetch(name: seg).delete
puts "Deleted Network Segment '#{seg}' from the JSS"
end # @segments_to_delete.each do |seg|
end # delete_segments
def update_segments
@@ -352,10 +351,10 @@
IPAddr.new("#{seg_data[:starting]}/#{seg_data[:ending]}").to_range.end.mask 32
else
IPAddr.new(seg_data[:ending])
end
- this_seg = JSS::NetworkSegment.new name: seg
+ this_seg = JSS::NetworkSegment.fetch name: seg
data_range = data_start..data_end
next if this_seg.range == data_range
if @noop
connector = @use_cidr ? '/' : '->'