Class: Chef::Knife::DataBagFromOktaGroup

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/data_bag_from_okta_group.rb

Instance Method Summary collapse

Instance Method Details

#runObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/chef/knife/data_bag_from_okta_group.rb', line 68

def run
  validate_arguments
  validate_okta_config
  setup

  begin
    Chef::DataBag.validate_name!(@data_bag_name)
  rescue Chef::Exceptions::InvalidDataBagName => e
    ui.fatal(e.message)
    exit(1)
  end

  if same_as_existing_data_bag_item?
    ui.info("Data bag item #{@data_bag_item_name} already exists and contains no changes, skipping upload")
    exit(0)
  end

  create_data_bag_if_missing
  create_data_bag_item_file
  display_data_bag_item_changes
  display_data_bag_item_members
  check_changes_within_range
  upload_data_bag_item
ensure
  FileUtils.remove_entry tmpdir if tmpdir
end