github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/cookbooks/swift/recipes/source.rb (about)

     1  # Copyright (c) 2015-2021, NVIDIA CORPORATION.
     2  # SPDX-License-Identifier: Apache-2.0
     3  
     4  
     5  # ensure source_root
     6  
     7  directory "#{node['source_root']}" do
     8    owner "#{node['swift_user']}"
     9    group "#{node['swift_group']}"
    10    action :create
    11  end
    12  
    13  # python install
    14  
    15  execute "git python-swiftclient" do
    16    cwd "#{node['source_root']}"
    17    command "sudo -u #{node['swift_user']} git clone -b #{node['swiftclient_repo_branch']} #{node['swiftclient_repo']}"
    18    creates "#{node['source_root']}/python-swiftclient"
    19    action :run
    20  end
    21  
    22  execute "git swift-bench" do
    23    cwd "#{node['source_root']}"
    24    command "sudo -u #{node['swift_user']} git clone -b #{node['swift_bench_repo_branch']} #{node['swift_bench_repo']}"
    25    creates "#{node['source_root']}/swift-bench"
    26    action :run
    27  end
    28  
    29  execute "git swift" do
    30    cwd "#{node['source_root']}"
    31    command "sudo -u #{node['swift_user']} git clone -b #{node['swift_repo_branch']} #{node['swift_repo']}"
    32    creates "#{node['source_root']}/swift"
    33    action :run
    34  end
    35  
    36  execute "fix semantic_version error from testtools" do
    37    command "pip install --upgrade testtools"
    38  end
    39  
    40  execute "python-swiftclient-install" do
    41    cwd "#{node['source_root']}/python-swiftclient"
    42    command "pip install -e . && pip install -r test-requirements.txt"
    43    if not node['full_reprovision']
    44      creates "/usr/local/lib/python2.7/dist-packages/python-swiftclient.egg-link"
    45    end
    46    action :run
    47  end
    48  
    49  execute "swift-bench-install" do
    50    cwd "#{node['source_root']}/swift-bench"
    51    # swift-bench has an old version of hacking in the test requirements,
    52    # seems to pull back pbr to 0.11 and break everything; not installing
    53    # swift-bench's test-requirements is probably better than that
    54    command "pip install -e ."
    55    if not node['full_reprovision']
    56      creates "/usr/local/lib/python2.7/dist-packages/swift-bench.egg-link"
    57    end
    58    action :run
    59  end
    60  
    61  execute "python-swift-install" do
    62    cwd "#{node['source_root']}/swift"
    63    command "pip install -e . && pip install -r test-requirements.txt"
    64    if not node['full_reprovision']
    65      creates "/usr/local/lib/python2.7/dist-packages/swift.egg-link"
    66    end
    67    action :run
    68  end
    69  
    70  execute "install tox" do
    71    command "pip install tox==3.5.3"
    72    if not node['full_reprovision']
    73      creates "/usr/local/lib/python2.7/dist-packages/tox"
    74    end
    75    action :run
    76  end
    77  
    78  [
    79    'swift',
    80    'python-swiftclient',
    81  ].each do |dirname|
    82    execute "ln #{dirname}" do
    83      command "ln -s #{node['source_root']}/#{dirname} /home/#{node['swift_user']}/#{dirname}"
    84      creates "/home/#{node['swift_user']}/#{dirname}"
    85    end
    86  end
    87