туман-лазурь-рм: создание дисков завершается сбоем из-за неинициализированной константы Azure::Core

Я не могу создать диски в Azure. Ниже приведены шаги, которые я сделал для создания, но это не удается.

Версии:

туман-лазурь-rm (0.3.2)

рубиновая версия 2.4.0

azure_storage_service = Fog::Storage::AzureRM.new(
  :tenant_id => '<Tenantid>',                                                      
  :client_id =>    '<Clientid>',                                                   
  :client_secret => '<ClientSecret>',                                              
  :subscription_id => '<Subscriptionid>'
)





 azure_storage_service.create_disk('disk_name',1023)

/usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-rm-0.3.2/lib/fog/azurerm/requests/storage/create_page_blob.rb:13:in `rescue in create_page_blob': uninitialized constant Azure::Core (NameError)
    from /usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-rm-0.3.2/lib/fog/azurerm/requests/storage/create_page_blob.rb:11:in `create_page_blob'
    from /usr/local/lib/ruby/gems/2.4.0/gems/fog-azure-rm-0.3.2/lib/fog/azurerm/requests/storage/create_disk.rb:37:in `create_disk'
    from createDisk.rb:12:in `<main>'

person Ram    schedule 13.09.2017    source источник


Ответы (1)


Прежде всего, вам нужно запросить библиотеку Fog, выполнив:

require 'fog/azurerm'

Затем, если вы используете существующую учетную запись хранения, добавьте учетную запись хранения и ключ к подключению. Если я удалю их из своего кода, я получу тот же журнал ошибок, что и вы. Следующие коды работают для меня. Пожалуйста, замените * на ваше значение.

require 'fog/azurerm'
azure_storage_service = Fog::Storage.new(
  :provider => 'AzureRM',
  :tenant_id => '*****',                                                       # Tenant id of Azure Active Directory Application
  :client_id =>    '*****************',                                                    # Client id of Azure Active Directory Application
  :client_secret => '************',                                               # Client Secret of Azure Active Directory Application
  :subscription_id => '***************',                                           # Subscription id of an Azure Account
  :azure_storage_account_name => 'shuiwindiag907',                            # Name of an Azure Storage Account
  :azure_storage_access_key => '************************',                               # Key of an Azure Storage Account
  :environment => 'AzureCloud' # Azure cloud environment. Default is AzureCloud.
)

azure_storage_service.create_disk('shui_test',5) ##By default the disk will be created in the container 'vhds'. If the container does not exist, please create it or set options[:container_name].

Дополнительную информацию см. в этом ссылка.

person Shui shengbao    schedule 14.09.2017
comment
Спасибо, что сработало для меня. Есть ли способ использовать подстановочные знаки при поиске VHD? - person Ram; 14.09.2017
comment
use wilcards in searching the vhds что ты имеешь в виду? - person Shui shengbao; 15.09.2017