Class: OpsManager

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, SessionConfig
Defined in:
lib/ops_manager.rb,
lib/ops_manager/cli.rb,
lib/ops_manager/errors.rb,
lib/ops_manager/semver.rb,
lib/ops_manager/logging.rb,
lib/ops_manager/version.rb,
lib/ops_manager/api/base.rb,
lib/ops_manager/api/opsman.rb,
lib/ops_manager/api/pivnet.rb,
lib/ops_manager/configs/base.rb,
lib/ops_manager/installation.rb,
lib/ops_manager/product_deployment.rb,
lib/ops_manager/deployments/vsphere.rb,
lib/ops_manager/installation_runner.rb,
lib/ops_manager/product_installation.rb,
lib/ops_manager/configs/opsman_deployment.rb,
lib/ops_manager/configs/product_deployment.rb,
lib/ops_manager/product_template_generator.rb,
lib/ops_manager/director_template_generator.rb

Defined Under Namespace

Modules: Api, Deployments, Logging Classes: ApplianceDeployment, Cli, Configs, DirectorTemplateGenerator, Installation, InstallationError, InstallationRunner, InstallationSettingsError, PivnetAuthenticationError, ProductDeployment, ProductDeploymentError, ProductInstallation, ProductTemplateGenerator, ProductUploadError, Semver, StemcellUploadError, UpgradeError

Constant Summary collapse

VERSION =
"0.5.0"

Class Method Summary collapse

Class Method Details

.login(username, password) ⇒ Object



47
48
49
50
51
# File 'lib/ops_manager.rb', line 47

def (username, password)
  set_conf(:username, username)
  set_conf(:password, password)
  opsman_api.get_token
end

.set_target(uri) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/ops_manager.rb', line 39

def set_target(uri)
  if target_is_pingable?(uri)
    set_conf(:target, uri)
  else
    puts "Can not connect to #{uri}".red
  end
end

.show_statusObject



30
31
32
33
34
35
36
37
# File 'lib/ops_manager.rb', line 30

def show_status
  authenticated = !!opsman_api.get_token ? 'YES'.green : 'NO'.red

  [
    "Target: #{self.get_conf(:target).green}",
    "Authenticated: #{authenticated}"
  ].join("\n")
end

.target_and_login(uri, username, password) ⇒ Object



53
54
55
56
# File 'lib/ops_manager.rb', line 53

def (uri, username, password)
  self.set_target(uri) if uri
  (username, password) if username && password
end